ASP.NET customized error page

  • Thread starter Thread starter Brian Henry
  • Start date Start date
B

Brian Henry

I want to have a custom page for errors, instead of the standard page which
we get now built into asp.net, so i can have the error page shown in the
company's template... how would i go about doing this? anything to do with
the application_error in the global.asax.vb file? thanks!
 
i guess i should add to this, and display the trace information in the
custom page..
 
Add this to the web.config file

<customErrors defaultRedirect="ErrorPage.aspx" mode="On">

</customErrors>

To get the trace information use:

Put this in the Application_Error section of the the global.asax.vb file

str = "Error: " & Server.GetLastError().InnerException.ToString() & vbCrLf &
vbCrLf & Request.Url.ToString & vbCrLf & "Message: " &
Server.GetLastError().Message.ToString & vbCrLf & " Source: " &
Server.GetLastError().Source.ToString

You may want/need to modify the above line - this is a cut 'n' paste from my
app.

Vinay
 
-----Original Message-----
I want to have a custom page for errors, instead of the standard page which
we get now built into asp.net, so i can have the error page shown in the
company's template... how would i go about doing this? anything to do with
the application_error in the global.asax.vb file? thanks!


.
 
Back
Top