The truth re On Error Resume Next

Discussion in 'ASP General' started by Laphan, Oct 26, 2005.

  1. Laphan

    Laphan Guest

    Hi Everybody

    I put the On Error Resume Next command as the very first line in my ASP
    pages, which may contain various inc files and sub-routines/functions, so
    that I can try and stop the dreaded DB error messages displaying to visitors
    and would-be hackers.

    My question is, does this one statement at the top of the page cater for all
    of the code that might be executed in the page, in the include files and in
    sub-routines/functions or do I have to put the statement in certain places
    as well?

    The reason I ask is that I'm sure if I get one of my include file names
    wrong it brings up an error rather than going straight through and
    displaying a funny page.

    I hope I don't have to put it in various places as I like to have this one
    statement so that I can flip back and forth between live and dev time and
    having to go into 'x' amount of pages to flip between these 2 states would
    be tiresome.

    Many thanks.

    Rgds

    Laphan
     
    Laphan, Oct 26, 2005
    #1
    1. Advertising

  2. Laphan wrote:
    > Hi Everybody
    >
    > I put the On Error Resume Next command as the very first line in my
    > ASP pages, which may contain various inc files and
    > sub-routines/functions, so that I can try and stop the dreaded DB
    > error messages displaying to visitors and would-be hackers.
    >
    > My question is, does this one statement at the top of the page cater
    > for all of the code that might be executed in the page, in the
    > include files and in sub-routines/functions or do I have to put the
    > statement in certain places as well?
    >

    I can't say it better than this. (There are related articles about
    error-handling in this blog so search them out. Also, be sure to read the
    comments)

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Oct 26, 2005
    #2
    1. Advertising

  3. Laphan

    Patrice Guest

    IMO avoid "On Error Resume Next" as much as possible. It will just hide
    errors instead of reporting them.

    Another option (and my personal preference) is to use a custom error page
    (see http://support.microsoft.com/default.aspx?scid=kb;en-us;224070) that
    displays a friendly message and warn the dev team about the error (it can
    even trap compile time errors)...

    Just my 2 eurocents...

    --
    Patrice

    "Laphan" <> a écrit dans le message de
    news:...
    > Hi Everybody
    >
    > I put the On Error Resume Next command as the very first line in my ASP
    > pages, which may contain various inc files and sub-routines/functions, so
    > that I can try and stop the dreaded DB error messages displaying to

    visitors
    > and would-be hackers.
    >
    > My question is, does this one statement at the top of the page cater for

    all
    > of the code that might be executed in the page, in the include files and

    in
    > sub-routines/functions or do I have to put the statement in certain places
    > as well?
    >
    > The reason I ask is that I'm sure if I get one of my include file names
    > wrong it brings up an error rather than going straight through and
    > displaying a funny page.
    >
    > I hope I don't have to put it in various places as I like to have this one
    > statement so that I can flip back and forth between live and dev time and
    > having to go into 'x' amount of pages to flip between these 2 states would
    > be tiresome.
    >
    > Many thanks.
    >
    > Rgds
    >
    > Laphan
    >
    >
     
    Patrice, Oct 26, 2005
    #3
  4. Bob Barrows [MVP] wrote:
    > Laphan wrote:
    >> Hi Everybody
    >>
    >> I put the On Error Resume Next command as the very first line in my
    >> ASP pages, which may contain various inc files and
    >> sub-routines/functions, so that I can try and stop the dreaded DB
    >> error messages displaying to visitors and would-be hackers.
    >>
    >> My question is, does this one statement at the top of the page cater
    >> for all of the code that might be executed in the page, in the
    >> include files and in sub-routines/functions or do I have to put the
    >> statement in certain places as well?
    >>

    > I can't say it better than this. (There are related articles about
    > error-handling in this blog so search them out. Also, be sure to read
    > the comments)
    >

    Oops. It would help to post the link, wouldn't it?
    http://blogs.msdn.com/ericlippert/archive/2004/08/19/217244.aspx
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Oct 26, 2005
    #4
    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. Kevin Spencer

    Re: QUERY: 'On Error Resume Next' scope rules

    Kevin Spencer, Jun 17, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    585
    Kevin Spencer
    Jun 17, 2006
  2. Deniz Bahar
    Replies:
    2
    Views:
    475
    Andrey Tarasevich
    Mar 9, 2005
  3. Jitu>>

    On Error Resume Next

    Jitu>>, Jul 14, 2003, in forum: ASP General
    Replies:
    1
    Views:
    182
    Ray at
    Jul 14, 2003
  4. jason

    Avoid On Error Resume Next?

    jason, Aug 14, 2003, in forum: ASP General
    Replies:
    7
    Views:
    179
    Ray at
    Aug 14, 2003
  5. jay
    Replies:
    1
    Views:
    117
    Austin Ziegler
    Feb 22, 2007
Loading...

Share This Page