Mega Code Archive

 
Categories / ASP.Net Tutorial / Page Lifecycle
 

Page ErrorPage

<%@ Page Language="vb" %> <html>    <head>       <title>ErrorPage property example</title>       <script runat="server">          Sub Page_Load()             Page.ErrorPage = "NextPage.aspx"             Dim x, y, overflow As Integer             x = 1             y = 0             overflow = x/y             'This code will not be executed             Message.Text = "Error Page is " & Page.ErrorPage & "."          End Sub       </script>    </head> <body>    <asp:label id="Message" runat="server"/> </body> </html> File: NextPage.aspx   <%@ Page Language="vb" %> <html>    <head>       <title>ErrorPage property example</title>       <script runat="server">          Sub Page_Load()             Message.Text = "An error occurred. Please try again later."          End Sub       </script>    </head> <body>    <asp:label id="Message" runat="server"/> </body> </html>