
IsPostBack | 251
Page Class
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
The extra characters in the value of the _ _VIEWSTATE hidden field indicate the view
state of the current page. The view state of a page includes the transient proper-
ties of server controls, such as BackColor or ForeColor.
Note that pages that do not contain a
<form> element with the runat="server"
attribute will not save view state, regardless of the value of the EnableViewState
property.
ErrorPage
String = Page.ErrorPage
Page.ErrorPage = String
Returns or sets the name of the page to redirect to in the event of an unhandled
page exception.
Parameter
String
A String value that indicates the name of the page to redirect to in the event
of an unhandled page exception.
Example
The next example changes the ErrorPage property and shows the executed page
when an unhandled exception occurs in the page:
Sub Page_Load( )
Page.ErrorPage = "ErrorPage_Handler.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
The Page_Load for ErrorPage_Handler.aspx follows:
Sub Page_Load( )
Message.Text = "We're sorry. An error occurred during the" & _
" processing of your request. Please try again later."
End Sub
Notes
The ErrorPage property can also be specified using the ErrorPage