Ray Costanzo [MVP] wrote:
>
> What's wrong with that code? There's no error there.
Sure there is. He left out the "Set" keyword when he defined the fso
variable
>
> Ray at home
>
>>
>> <html>
>> <body>
>> <form action="homepage.asp" method="get">
>> Server to Manage: <input type="text" name="strComputer" size="20" />
>> <input type="submit" value="Submit" />
>> </form>
>> <%
>> dim strComputer
>> strComputer=Request.QueryString("strComputer")
>>
>> If fname<>"" Then
>> fso = Server.CreateObject ("scripting.filesystemObject")
>> if fso.folderexists ("C:\checkEvent\Logs\" & strComputer) then
>> response.write ("this server is already managed")
>> End If
>> End If
>> %>
>> </body>
>> </html>
>>
This should cause an error page to display, unless fname contains "", which
will likely be the case since it is never defined anywhere in your code.
When I change the code to:
If strComputer<>"" Then
Then I get this error page when I submit data:
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be
displayed.
--------------------------------------------------------------------------------
Please try the following:
Click the Refresh button, or try again later.
Open the localhost home page, and then look for links to the information you
want.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'fso'
/test/errortest1.asp, line 12
Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
Page:
GET /test/errortest1.asp
Time:
Saturday, October 29, 2005, 8:03:44 AM
More information:
Microsoft Support
Having said that, you will probably want to handle errors a little more
gracefullly than this, won't you? For starters, you can use an asp class to
ease debugging:
http://support.microsoft.com/kb/299986/EN-US/
The idea is that the user does not need to see detailed error messages
because there is likely to be nothing that the user can do about the problem
that caused the error. Also, in many cases, displaying detailed messages can
reveal details about your site and database that hackers can use to
penetrate your security. Think of a hacker deliberately causing errors to
occur so he can see your field names, etc.
So what you should be thinking about is using "on error resume next" to trap
your errors, logging your detailed error messages for debugging purposes,
and displaying nothing more than "An error has occurred" to your users.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"