That's a good idea....
I've never used a URL redirect before. What is the format that IIS wants? I tried putting in the various styles and it still doesn't like them.
Main Topics
Browse All TopicsI used to have a custom error page in ASP on IIS 4.
When we upgraded to IIS 5 it stopped working.
I'm puzzled as to why it's not working and I've searched hi and low for a solution. I consider this difficult because I have not been able to locate the answer and the page works when called directly.
1) Desired Result: Upon an error, this page is called and an email is sent detailing the problem. The user sees a friendly error page. Critical details are hidden from prying eyes.
What's happening:
- When an error occurs, the page loads, but doesn't send the email or display the error.
- When the page is called directly www.server.com\errors\404.
- when the page is called by IIS in response to an error, nothing. No error, no string, no email.
Language used, VB Script.
Used to be CDONTS, upgraded to new CDO model (really easy actually).
What I've tried:
I've hardcoded some response.write strings to force the output and try to trace the issue.
Server Environment:
Capable hardware, running 2003 Web Server Edition.
Stable production web server
Acceptable to good security configuration.
We have the machine audited weekly.
We are running the lockdown script to disable ports.
Server is on a firewalled network. So when we look at the server directly the 192.168.1.x test will spit out the error directly so we can see it.
Other observations:
The page works when called directly.
Emails work from other functions on the site.
Removing all code except the email generator results in the same activity, no email is sent.
Hunches:
1) Server configuration that I don't know about.
2) Restriction in execution capabilities during error... ?
3) Minor mistake in code somewhere.
Live example ommitted because when I get it working I don't want 33000 emails.
Code:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<head>
<META NAME="ROBOTS" CONTENT="NOINDEX">
<title>A system Error has occured.</title>
</head>
<body >
<%
Dim objASPError, blnErrorWritten, strServername, strServerIP, strRemoteIP
'If Response.Buffer Then
' Response.Clear
' Response.Status = "Server Error"
' Response.ContentType = "text/html"
' Response.Expires = 0
'End If
Set objASPError = Server.GetLastError
Dim strErrorDescription
strErrorDescription = "Category=" & objASPError.Category & vbCrLf
If objASPError.ASPCode <> "" Then
strErrorDescription = strErrorDescription & "Code=" & objASPError.ASPCode & vbCrLf
End If
strErrorDescription = strErrorDescription & "Number=(0x" & Hex(objASPError.Number) & ")" & vbCrLf
strErrorDescription = strErrorDescription & "Description=" & objASPError.Description & vbCrLf
If objASPError.ASPDescription
strErrorDescription = strErrorDescription & "ASP Error Description=" & objASPError.Description
End If
blnErrorWritten = False
strServername = LCase(Request.ServerVariab
strServerIP = Request.ServerVariables("L
strRemoteIP = Request.ServerVariables("R
If objASPError.Source <> "" Then
strErrorDescription = strErrorDescription & "File=" & objASPError.File & vbCrLf
If objASPError.Line > 0 Then
strErrorDescription = strErrorDescription & "Line=" & objASPError.Line
End If
If objASPError.Column > 0 Then
strErrorDescription = strErrorDescription & ", Column= " & objASPError.Column
End If
strErrorDescription = strErrorDescription & vbCrLf
strErrorDescription = strErrorDescription & "Code:" & vbCrLf & Server.HTMLEncode(objASPEr
If objASPError.Column > 0 Then
strErrorDescription = strErrorDescription & String((objASPError.Column
End If
blnErrorWritten = True
End If
If Not blnErrorWritten And objASPError.File <> "?" Then
strErrorDescription = strErrorDescription & vbCrLf & "Filename=" & objASPError.File & vbCrLf
If objASPError.Line > 0 Then
strErrorDescription = strErrorDescription & "Number=" & objASPError.line
End If
If objASPError.Column > 0 Then
strErrorDescription = strErrorDescription & ", Column=" & objASPError.Column
End If
strErrorDescription = strErrorDescription & vbCrLf
End If
Dim mymail, strBody
Set mymail = Server.CreateObject("CDO.m
mymail.From = "ommitted"
mymail.To ="ommitted"
mymail.Subject = "ASP Error Occurred @"&now&" on "&date
strBody = "An error occured on server=" & strServername&vbcrlf&" IP Address=" & strServerIP&vbcrlf
strbody = strbody &vbcrlf& " Client IP=" & strRemoteIP&vbcrlf
strBody = strBody & " at " & Now() & vbCrlf
strBody = strBody & "BrowserType=" & Request.ServerVariables("H
strbody = strbody & "Method=" & Request.ServerVariables("R
strbody = strbody&"URL Called was: "&request.servervariables(
strbody = strbody&"Query was: "&request.servervariables(
strbody = strbody&"Path was: "&request.servervariables(
strbody = strbody&"Referred by: "&request.ServerVariables(
strbody = strbody& "Error Message:"&vbcr&strErrorDes
if sqlstring<>"" then strbody = strbody& "SQL"&sqlstring
mymail.textBody = strBody
response.write(strbody)
mymail.Send
Set mymail = Nothing
if instr(1,strremotip,"192.16
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: leechoonhweePosted on 2005-11-24 at 10:50:27ID: 15357761
Try changing the map to an URL instead of file.