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 Do I Supress Public ASP Errors

Status
Not open for further replies.

technobia

ISP
Sep 8, 2005
53
0
0
US
I am the server Admin for a webmaster who designed a site in Straight ASP using SQL Server 2000 SP4. I am not a literate ASP programmer and the webmaster is not very experienced either.

So, I am soliciting some assistance with how to having non-informative ASP error messages appearing to the public?

For example we recently encountered a permissions issues that generated the following error message that was displayed at the bottom of the website web page. Although this issue is resolved we want to prevent this kind of descriptive error code from being public.
For example:

Active Server Pages error 'ASP 0113'
Script timed out
/lectures.asp

All I have been able to find so far is the custom error pages in IIS. There are a bunch of htm pages with various messages but none of them have any error like the one above. The messages I am referring to are added to the website page, they are not a separate error page as the ones in IIS appear to be. This leads me to believe that I am not looking in the correct place.

I would greatly appreciate anyone pointing me in the right direction.

Thanks
Technobia
 
P.S. This site is hosted on a dedicated Windows 2003 Server running IIS 6.0
 
If everyone is using Internet Explorer then you can click Tools...Options...Advanced and put a tick in the box 'show friendly http error messages'.

I would advise against this though as if there is an error in a script it makes it very hard if not impossible to tell where the problem is.

E.
 
If you look at the error pages in IIS (Control Panel -> Admin. Tools -> IIS -> Expand, Expand -> Default Website -> Rt Click, Properties -> Custom Error Pages) you will see all of the pages that your webserver uses to display errors to the end user. One common one to modify is the 404. That way when your users manage to get to a page tat they shouldn't have you can display a 404 page that fits in with the look and feel of your site so that the user feels they are still visiting you, not bounced back to a generic page.

So anyways, the one we are looking for that displays errors is the 500-100 page. The path is listed next to it, usually something like iisHelp/common/500-100.asp (you'll have to forgive me, I'm on my linux box at the moment, not my windows one). The iisHelp folder is located in C:\Windows\help.
You have two options, you can either make a new page from scratch and change the address this points to, or you can editthe existing 500-100.asp page. I would suggest making a copy if you decide to edit the original.

Unfortunatly I don't know if that page is called to process errors that occur after you start sending content tot the user (the ones that just show the little error paragraph in your page, as opposed to showing the 500-100 page). Your best bet there would be to test the heck out of your site, then use "On Error Resume Next" to skip errors and occasionally check if err.Number <> 0

-T

signature.png
 
Not the greatest way, but the way I do it is this
at the start of my script i Have
On Error Resume Next

Then at the bottom i have

if err.number <> 0 then
blah
end if

eg
Code:
<% 
on error resume next

response.write(err.asd)

if not err.number = 0 then errorTrap(err)

sub errorTrap(trapped)
	dim url 
	url = request.ServerVariables("SERVER_NAME") & request.ServerVariables("PATH_INFO")
	if request.ServerVariables("QUERY_STRING") <> "" then 
		url = url & "?" & request.ServerVariables("QUERY_STRING")
	end if
	response.write("<span class='error'>There has been an error.  Please call  blah blah and quote the following.<br />" &_ 
	trapped.description &"<br />"& url & "</span>")
end sub
%>

}...the bane of my life!
 
Thanks everyone for your help. I did find the debugging tab in IIS and am waiting on the webmaster to force some errors and let me know what happens.

I will also look into the 500-100.asp file. Does anyone know if the ASP 0311 error is a 500-100 error? I do not know if I am supposed to ignore the leading zero or not.

The webmaster used the On Error Resume Next but I do not think she used the last checking portion. I will suggest that.

I will post more when I have more information or questions.

Thanks again - Technobia
 
Since I got here late, all I can provide is my force500error.asp page,

Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% 
    functionThatDoesNotExist() 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/loose.dtd">[/URL]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>

</body>
</html>

I built mine to show a simple page to the user, log the error to the database and send an email to me about it.

Drew
 
Yeah if you use the on error resume next on its own you get no errors at all, the page just either shows what it can or breaks and does nothing!!

}...the bane of my life!
 
The standard MS IIS error ASP's present the user with a lot unusefull information. You as the programmer basically wants to know the script name and line number, but your user can't find that.
So i changed the (most common) error ASP's:
- They automatically store the relevant data in a database table
- They send me an email
- They present the user a friendly screen telling them something went wrong and yes i'm working on that asap (from my boat in the Caribean)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top