problem (asp newbie)

Discussion in 'ASP General' started by barabba72@hotmail.com, Oct 29, 2005.

  1. Guest

    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>
    , Oct 29, 2005
    #1
    1. Advertising

  2. 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:...
    > 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>
    >
    Ray Costanzo [MVP], Oct 29, 2005
    #2
    1. Advertising

  3. Guest

    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.
    , Oct 29, 2005
    #3
  4. <> wrote in message
    news:...
    > 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.
    >
    Ray Costanzo [MVP], Oct 29, 2005
    #4
  5. 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"
    Bob Barrows [MVP], Oct 29, 2005
    #5
  6. 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"
    Bob Barrows [MVP], Oct 29, 2005
    #6
  7. Larry Bud Guest

    wrote:
    > 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.
    Larry Bud, Nov 1, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Id0x
    Replies:
    4
    Views:
    1,184
    Erik Max Francis
    Jul 21, 2003
  2. JohnE

    newbie with newbie questions

    JohnE, Aug 17, 2009, in forum: ASP .Net
    Replies:
    3
    Views:
    493
    Gregory A. Beamer
    Aug 17, 2009
  3. Jerry C.
    Replies:
    8
    Views:
    223
    Uri Guttman
    Nov 23, 2003
  4. Kruno Saho
    Replies:
    0
    Views:
    134
    Kruno Saho
    Apr 7, 2013
  5. Dave Angel
    Replies:
    0
    Views:
    116
    Dave Angel
    Apr 7, 2013
Loading...

Share This Page