ErrorPage Property
.NET Framework Class Library
Page..::.ErrorPage Property

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

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
Visual Basic (Declaration)
<BrowsableAttribute(False)> _
Public Property ErrorPage As String
Visual Basic (Usage)
Dim instance As Page
Dim value As String

value = instance.ErrorPage

instance.ErrorPage = value
C#
[BrowsableAttribute(false)]
public string ErrorPage { get; set; }
Visual C++
[BrowsableAttribute(false)]
public:
property String^ ErrorPage {
    String^ get ();
    void set (String^ value);
}
JScript
public function get ErrorPage () : String
public function set ErrorPage (value : String)
ASP.NET
<asp:Page ErrorPage="String" />

Property Value

Type: System..::.String
The error page to which the browser is redirected.
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";
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Why doesn't this work for me?      Daniel Raillant-Clark ... Thomas Lee   |   Edit   |   Show History

Have I misunderstood what this property's documentation means by "sets the error page to which the requesting browser is redirected in the event of an unhandled page exception"? My scenario: - a web application with a master page, a Default.aspx page and an Error.aspx page - Default and Error both use the master page - Default.aspx has ErrorPage="Error.aspx" in the @Page directive - the first line of Default's Page_Load method is "throw new Exception();" - the redirect to Error.aspx does not happen I have managed to catch the exception and redirect through the following separate means: 1) Attaching a handler to the Page.Error event (in Page_Load "this.Error += this.Error += new EventHandler(HandleError);") or2) Overriding Page_Error and setting AutoEventWireup to trueor 3) Overriding Application_Error in my Global.asax But none of this seems to have any relationship to Page.ErrorPage. Is this property just a container for me to save the URL of my error page? Or is there something else I need to set so that ASP.NET redirects to the page defined by this property?

[tfl - 20 05 09] Hi - and thanks for your post. You should post questions like this to the MSDN Forums at http://forums.microsoft.com/msdn or the MSDN Newsgroups at 
  http://www.microsoft.com/communities/newsgroups/en-us/. You are much more likely get a quicker response using the forums than through the Community Content. For specific help about:
Visual Studio : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.vstudio%2C&
.NET Framework : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public.dotnet.framework
All Public : http://groups.google.com/groups/dir?sel=usenet%3Dmicrosoft.public%2C&
 

Processing
Page view tracker