problem (asp newbie)

B

barabba72

be patient, it's me again:

I copied this code from
http://http://www.w3schools.com/asp/showasp.asp?filename=demo_reqquery.

I created the file demo_reqquery.asp in the web site folder but when I
execute it, after digiting a name and pressing enter, not output is
produced (ie the string "hello, etc.." and "how are you today" are not
displayed).

What could be wrong ? Permissions are ok.

Thanks again in advance...


<html>
<body>
<form action="demo_reqquery.asp" method="get">
Your name: <input type="text" name="fname" size="20" />
<input type="submit" value="Submit" />
</form>
<%
dim fname
fname=Request.QueryString("fname")
If fname<>"" Then
Response.Write("Hello " & fname & "!<br />")
Response.Write("How are you today?")
End If
%>
</body>
</html>
 
R

Ray Costanzo [MVP]

It works as expected for me. Is that the code in your page, or is that just
copied and pasted from that site?

Ray at home
 
B

barabba72

Sorry, it's my fault, I mispelled the asp page !

I have a question though:

when I deal with vbscript (not with ASP which is totally new to me), if
I launch a vbscript that contains an error, the interpreter stops
telling me where the error was thrown (line number) along with the
error number and description.

I notice in ASP that if an error is detected, the page simply doesn't
display.
How am I supposed to debug my code ? I'm sure I missed something !

For example, the code below won't load. I'm rather sure that in a
traditional vbscript it would not be such a pain:

<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>



Thanks again for your time.
 
R

Ray Costanzo [MVP]

Sorry, it's my fault, I mispelled the asp page !

I have a question though:

It's typically best to start a new thread for new questions so they don't go
unnoticed by others.

when I deal with vbscript (not with ASP which is totally new to me), if
I launch a vbscript that contains an error, the interpreter stops
telling me where the error was thrown (line number) along with the
error number and description.

ASP gives you that and more!

I notice in ASP that if an error is detected, the page simply doesn't
display.

What do you see instead? Does your browser close? Certainly something must
be displayed.
How am I supposed to debug my code ? I'm sure I missed something !

For example, the code below won't load. I'm rather sure that in a
traditional vbscript it would not be such a pain:

What's wrong with that code? There's no error there.

Ray at home
 
B

Bob Barrows [MVP]

Ray said:
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

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
 
L

Larry Bud

be patient, it's me again:

I copied this code from
http://http://www.w3schools.com/asp/showasp.asp?filename=demo_reqquery.

I created the file demo_reqquery.asp in the web site folder but when I
execute it, after digiting a name and pressing enter, not output is
produced (ie the string "hello, etc.." and "how are you today" are not
displayed).

If you're using IE, and you haven't set up your browser to display
detailed error messages, now is the time to do it:

Go to TOOLS | Internet Options | Advanced... scroll down a bit and
UNCHECK "Show Friendly HTTP Error Messages"

If you're trying to debug your ASP and this is checked, you'll get a
generic "page can't be displayed" error. If you uncheck it, it will
show you the result from the ASP engine.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,248
Latest member
MagdalenaB

Latest Threads

Top