473,395 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Page.Error handler returning a blank page

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
2 5224
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill | last post by:
Hi. I have a multi-page form where the user enters datails to be submitted to a database on the final page. To move through the pages I have Next and Previous buttons using the following...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
0
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is...
1
by: bennett | last post by:
At http://www.brainjammer.com/testing/validator_test.aspx I have a text field where you can enter text, and a button where if you click the button, it sets the value of a label below it, to...
2
by: Mahesh Nimbalkar | last post by:
In my class library I need to access my current Webform (class). As I am using HttpHandler for ASPX page, following lines of code are throwing error that {"Specified cast is not valid." }. //...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.