Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Page.Error handler returning a blank page

Reply
Thread Tools

Page.Error handler returning a blank page

 
 
David R
Guest
Posts: n/a
 
      03-22-2006
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



 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGFuZHVyYW5nIE5heWFr?=
Guest
Posts: n/a
 
      03-23-2006
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
>
>
>
>

 
Reply With Quote
 
 
 
 
David R
Guest
Posts: n/a
 
      03-23-2006
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:(E-Mail Removed)...
> 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
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
blank CD-R and blank DVD-R not recognized by Vista 64 Ultimate =?Utf-8?B?R3JlZyBLaXJrcGF0cmljaw==?= Windows 64bit 13 11-07-2007 12:23 PM
How does a handler render the request to another handler in the MVC of SPRING 2.0.1 framework? rayzyang@gmail.com Java 0 05-30-2007 11:28 AM
Event Handler that creates adds another event handler kaczmar2@gmail.com ASP .Net 1 02-22-2007 07:37 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM



Advertisments