Home All Groups Group Topic Archive Search About
Author
14 Nov 2005 10:11 AM
Sam Solomon
Dear All,

I am using Page_Error event in my aspx page to generate an error. Below is
my code in my Page_Error event:


private void Page_Error(object sender,System.EventArgs e)

{

Response.Write("Error:\n");

Exception ex = Server.GetLastError();

Trace.Write("Message",ex.Message);

Trace.Write("Source",ex.Source);

Trace.Write("Stack Trace",ex.StackTrace);

Response.Write("Sorry, an error was encountered.");

Context.ClearError();

}

However the error is not generated because AutoEventWireup property is set
to "false". When I set the AutoEventWireupto "true"  is can see the error. I
want to know the reason behind this whats AutoEventWireup got to do with 
Page_Error event. . How are they both co-related.

Any help would be greatly appreciated

cheers,

Sam Solomon

Author
16 Nov 2005 3:59 PM
Keith Patrick
In ASP.Net 1.1, those methods were named by convention, but the templates
for usercontrols/pages would put in the wireup for you by overriding OnInit
and saying Page.Load += new ....(this.Page_Load);  AutoEventWireUp is a
means of doing that automatically by the page upon initialization.  If that
value is true, on init, a page checks for Page_<event>, and if it has been
defined in the code, an event handler will wrap it.