Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > problem (asp newbie)

Reply
Thread Tools

problem (asp newbie)

 
 
barabba72@hotmail.com
Guest
Posts: n/a
 
      10-28-2005
be patient, it's me again:

I copied this code from
http://http://www.w3schools.com/asp/...=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>

 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-28-2005
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

<> wrote in message
news: ups.com...
> be patient, it's me again:
>
> I copied this code from
> http://http://www.w3schools.com/asp/...=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>
>



 
Reply With Quote
 
 
 
 
barabba72@hotmail.com
Guest
Posts: n/a
 
      10-29-2005
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.

 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      10-29-2005

<> wrote in message
news: oups.com...
> 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

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



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-29-2005
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"


 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      10-29-2005
Oh! And don't forget to turn off "Friendly errors" in your browser ...

http://www.aspfaq.com/show.asp?id=2109

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


 
Reply With Quote
 
Larry Bud
Guest
Posts: n/a
 
      11-01-2005

wrote:
> be patient, it's me again:
>
> I copied this code from
> http://http://www.w3schools.com/asp/...=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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57