Export (0) Print
Expand All

Page.ErrorPage Property

Gets or sets the error page to which the requesting browser is redirected in the event of an unhandled page exception.

[Visual Basic]
Public Property ErrorPage As String
[C#]
public string ErrorPage {get; set;}
[C++]
public: __property String* get_ErrorPage();
public: __property void set_ErrorPage(String*);
[JScript]
public function get ErrorPage() : String;
public function set ErrorPage(String);

Property Value

The error page to which the browser is redirected.

Example

[Visual Basic] 
Sub Page_Load(Sender As Object, e As EventArgs)

   ' Note: This property can also be set in <%@ Page ...> tag.
   If (Not IsPostBack) Then
      Me.ErrorPage = "Error_Page.aspx"
 End If
End Sub

[C#] 
void Page_Load(Object sender, EventArgs e)
{
   // Note: This property can also be set in <%@ Page ...> tag.
   if(!IsPostBack)
      this.ErrorPage = "Error_Page.aspx";
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

Page Class | Page Members | System.Web.UI Namespace

Show:
© 2014 Microsoft