In the web.config file, locate the
customErrors section. Set the mode to on and set the
URL for the default redirect.
The web.config file is as follows:
<customErrors mode="On" defaultRedirect="Recipe0901bvb.aspx"/>
In <script runat="server" /> block or codebehind:
Sub Page_Load(sender As Object, e As EventArgs)
Dim a as Integer=1/0
End Sub
The error handler page is as follows:
<html>
<body>
<form id="Recipe0901bvb" method="post" runat="server">
An error has occurred in this application.
</form>
</body>
</html>
Comments
Whenever an unhandled error occurs anywhere in your application, the users are directed
to your custom error screen.This is an important part of creating a professional and
secure Web site. Note that the contents of the web.config file are case sensitive.
No comments:
Post a Comment