Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to display default page on error?

Status
Not open for further replies.

dnstapes

Programmer
Jul 17, 2001
38
0
0
US
The way my ASP is set up right now, an error is generated if the database is missing certain pieces of data. Instead of displaying the generic error page that just states the line number where the error occured, I'd like to show a more user-friendly error page for the users of the webpages. Is there some kind of onError function? If so, how is it used?

Thanks
 
On Error Resume Next

will skip over any errors that occur;

usage:
assume con is a connection object, and sqlstr is a sql string

function myfunction()
on error resume next
con.execute(sqlstring)

'Err _is_ case sensitive... cannot be err
if Err.number <> 0 then
Err.clear
Response.redirect(&quot;myerrpage.asp&quot;)
end if
end function

you can put on error resume next at the top of your pages, if you'd like, and that will do error checking for the entire page.

There's more info on it at the MS site

hth ---------
Leo Mendoza
lmendoza@students.depaul.edu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top