powerfool
asked on
asp in windows 2000
hi, i'm using win2000 server (previously win NT) and i'm about trying my asp pages, then I found if something error in my code, the browser will display page not found and doesn't tell me what's wrong, it makes me difficult to debug. Is there any solution to show "user friendly error" ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
It is also good practice to change the page not found standard message to redirect the user to your home page.
testing
Furthermore, I would stongly advise not to use ASP for you main applciation; call a VB ActiveX DLL instead becuase you get fantasic reliability and much better debugging. You will get your project done much faster.
Here is an example ASP to call a VB ActiveX, you may be doing this already - but if you are not save yourself months of pain.
<%
Option Explicit
DIM VIP
On Error Resume Next
Err.Clear
Do
Set VIP=Server.CreateObject("V IPASP30.Pa ger") ' a link to your project
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1020 Error: " & cstr(err.number) & " - " & Err.Description
Response.Redirect "DLLDown.asp"
Exit Do
Else
VIP.Register Server, Request, Response, Application, Session
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1050 Error: " & cstr(err.number) & " - " & Err.Description
Response.Redirect "DLLDown.asp"
Exit Do
End If
VIP.GetPage
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1090 Error: " & cstr(err.number) & " - " & Err.Description + "~ " VIP.Stage
Response.Redirect "DLLDown.asp"
Exit Do
Else
Session("CrashCount) = 0
End If
End If
exit do
Loop
Set VIP = Nothing
%>
Your DLLDown.ASP can send you an email with the error details and the rediect to you home page if
Session("CrashCount) is zero Like:
Session("CrashCount)=cLng( Session("C rashCount) ) + 1
if Session("CrashCount) < 2 Then
Response.Redirect "http://youserver/youhomepage.asp"
else
' tell them sorry
Response.Redirect "http://youserver/astaticpage.htm"
end if
Here is an example ASP to call a VB ActiveX, you may be doing this already - but if you are not save yourself months of pain.
<%
Option Explicit
DIM VIP
On Error Resume Next
Err.Clear
Do
Set VIP=Server.CreateObject("V
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1020 Error: " & cstr(err.number) & " - " & Err.Description
Response.Redirect "DLLDown.asp"
Exit Do
Else
VIP.Register Server, Request, Response, Application, Session
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1050 Error: " & cstr(err.number) & " - " & Err.Description
Response.Redirect "DLLDown.asp"
Exit Do
End If
VIP.GetPage
If Err.number<>0 Then
Session("ErrorMessage") = "Step 1090 Error: " & cstr(err.number) & " - " & Err.Description + "~ " VIP.Stage
Response.Redirect "DLLDown.asp"
Exit Do
Else
Session("CrashCount) = 0
End If
End If
exit do
Loop
Set VIP = Nothing
%>
Your DLLDown.ASP can send you an email with the error details and the rediect to you home page if
Session("CrashCount) is zero Like:
Session("CrashCount)=cLng(
if Session("CrashCount) < 2 Then
Response.Redirect "http://youserver/youhomepage.asp"
else
' tell them sorry
Response.Redirect "http://youserver/astaticpage.htm"
end if
ASKER
thanks all!
hongjun