By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,108 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

Page.Error handler returning a blank page

P: n/a
I've been following the "ASP.NET Custom Error Pages" article
(http://www.aspnetresources.com/artic...rorPages.aspx), but when I
implement either subscribing to base.Error or overriding base.OnError an
empty page is returned to the client browser.

During debugging, the event fires fine, and the page has the right controls
loaded, but ASP.NET just isn't rendering them (So a blank page is returned
to the client browser).

This is what I've got:

public MyPage() {
this.Init += new EventHandler(Page_Init);
this.Error += new EventHandler(Page_Error);
}

private void Page_Init(object sender, EventArgs e) {
try {
// Load a bunch of controls and add them to the page
} catch (Exception Ex) {
Load500(Ex);
}
}
protected override void OnError(EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError (e);
}

/* private void Page_Error(object sender, EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError(e);
} */

(The second function is commented out)

Load500 is a function that takes an Exception and converts it to a text
string before adding it to the control tree.

Any ideas?

Thanks
--
-David

Mar 22 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Dumb question - Are you doing the

HttpContext ctx = HttpContext.Current;
..
..
ctx.Response.Write (errorInfo);

that is mentioned in the article?

Regards
Pandurang
--
blog: www.thinkingMS.com/pandurang
"David R" wrote:
I've been following the "ASP.NET Custom Error Pages" article
(http://www.aspnetresources.com/artic...rorPages.aspx), but when I
implement either subscribing to base.Error or overriding base.OnError an
empty page is returned to the client browser.

During debugging, the event fires fine, and the page has the right controls
loaded, but ASP.NET just isn't rendering them (So a blank page is returned
to the client browser).

This is what I've got:

public MyPage() {
this.Init += new EventHandler(Page_Init);
this.Error += new EventHandler(Page_Error);
}

private void Page_Init(object sender, EventArgs e) {
try {
// Load a bunch of controls and add them to the page
} catch (Exception Ex) {
Load500(Ex);
}
}
protected override void OnError(EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError (e);
}

/* private void Page_Error(object sender, EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError(e);
} */

(The second function is commented out)

Load500 is a function that takes an Exception and converts it to a text
string before adding it to the control tree.

Any ideas?

Thanks
--
-David

Mar 23 '06 #2

P: n/a
I'm not calling Response.Write() at all, I'm just subscribing to the event.

....does the context get restarted when there's an error or something?
"Pandurang Nayak" <pandurangATthinkingmsDOT(nospam)com> wrote in message
news:83**********************************@microsof t.com...
Dumb question - Are you doing the

HttpContext ctx = HttpContext.Current;
.
.
ctx.Response.Write (errorInfo);

that is mentioned in the article?

Regards
Pandurang
--
blog: www.thinkingMS.com/pandurang
"David R" wrote:
I've been following the "ASP.NET Custom Error Pages" article
(http://www.aspnetresources.com/artic...rorPages.aspx), but when
I
implement either subscribing to base.Error or overriding base.OnError an
empty page is returned to the client browser.

During debugging, the event fires fine, and the page has the right
controls
loaded, but ASP.NET just isn't rendering them (So a blank page is
returned
to the client browser).

This is what I've got:

public MyPage() {
this.Init += new EventHandler(Page_Init);
this.Error += new EventHandler(Page_Error);
}

private void Page_Init(object sender, EventArgs e) {
try {
// Load a bunch of controls and add them to the page
} catch (Exception Ex) {
Load500(Ex);
}
}
protected override void OnError(EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError (e);
}

/* private void Page_Error(object sender, EventArgs e) {
Load500( Server.GetLastError() );
Server.ClearError();
base.OnError(e);
} */

(The second function is commented out)

Load500 is a function that takes an Exception and converts it to a text
string before adding it to the control tree.

Any ideas?

Thanks
--
-David

Mar 23 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.