My Little Help Desk - ASP Help Forum
My Little Help Desk - ASP Help Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 My Little Help Desk - ASP Help
 Active Server Pages
 Custom Error Pages
 New Topic  Reply to Topic
Author Topic  

MasonX

3 Posts

Posted - 09/14/2006 :  16:31:30  Show Profile  Reply with Quote
How can I get rid of the VBScript Error pages, and make my own page to display custom error pages, and also notify me when they occur?

alorentz

66 Posts

Posted - 09/14/2006 :  19:59:32  Show Profile  Reply with Quote
Here is example of custom error page:
<table ID="Table1">
<% If Len(CStr(objError.ASPCode)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">IIS Error Number</th>
<td align="left" valign="top"><%=objError.ASPCode%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.Number)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">COM Error Number</th>
<td align="left" valign="top"><%=objError.Number%>
<%=" (0x" & Hex(objError.Number) & ")"%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.Source)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">Error Source</th>
<td align="left" valign="top"><%=objError.Source%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.File)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">File Name</th>
<td align="left" valign="top"><%=objError.File%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.Line)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">Line Number</th>
<td align="left" valign="top"><%=objError.Line%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.Description)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">Brief Description</th>
<td align="left" valign="top"><%=objError.Description%></td>
</tr>
<% End If %>
<% If Len(CStr(objError.ASPDescription)) > 0 Then %>
<tr>
<th nowrap align="left" valign="top">Full Description</th>
<td align="left" valign="top"><%=objError.ASPDescription%></td>
</tr>
<% End If %>
</table>

<%
Go to Top of Page

alorentz

66 Posts

Posted - 09/14/2006 :  20:01:27  Show Profile  Reply with Quote
If you want to add email, just add a CDO sript to send email when the page is fired.

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "CDO Message"
objMessage.From = "me@domain.com"
objMessage.To = "to@domain.com"
objMessage.TextBody = "Test."
objMessage.Send
Go to Top of Page

alorentz

66 Posts

Posted - 09/14/2006 :  20:03:08  Show Profile  Reply with Quote
Oh yeah, in IIS manager you need to point server error 500:100 "ASP Error" to your new error page. That will call your new page whenever there is an ASP error.
Go to Top of Page

MasonX

3 Posts

Posted - 09/17/2006 :  10:33:23  Show Profile  Reply with Quote
Thanks.
Go to Top of Page
  Topic  
 New Topic  Reply to Topic
Jump To:
My Little Help Desk - ASP Help Forum © mylittlehelpdesk.com Go To Top Of Page
Snitz Forums 2000