473,883 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

errorPage attribute

Paxxer
22 New Member
Hi All,

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="C#" 
  2.          MasterPageFile="~/MasterPages/MyMaster.master"
  3.          errorPage="~/Errors/Error.aspx"
  4.          Title="This will have an Error"
  5.          AutoEventWireup="true"
  6.          CodeFile="NewError.aspx.cs"
  7.          Inherits="NewError" %>
When I throw an error the server does not redirect over to Error.aspx.

Instead it gives me the unhandled error message that I see even without the errorPage directive.

Any Ideas
Thanks
Tom
Feb 16 '09 #1
8 1983
kenobewan
4,871 Recognized Expert Specialist
Is this overridden by what is in your web.config error handling?
Feb 17 '09 #2
Paxxer
22 New Member
Hi Kenobewan,

I don't understand what you mean by "overridden ", I would expect the Parameter collection to throw an error according to the Link in my original post.

If you mean, am I catching the error and then canceling it, no I am not. It doesn't seem to be raised in the first place.
Feb 17 '09 #3
kenobewan
4,871 Recognized Expert Specialist
Do you have any error handling code in your web.config?
Feb 18 '09 #4
Frinavale
9,735 Recognized Expert Moderator Expert
Kenobewan's asking if you have set up custom errors in your web.config file.

For example, if you place the following in your web.config in the <system.web> section, your application will redirect the user to the "~/Errors/Error.aspx" page:
Expand|Select|Wrap|Line Numbers
  1. <customErrors mode="RemoteOnly" defaultRedirect="~/Errors/Error.aspx">
  2. </customErrors>
Feb 18 '09 #5
Paxxer
22 New Member
Thanks all.

I've tried several configurations of error handling in the config file. It behaves as you would expect and will route error handling to the appropriate page. However, I would expect the errorPage attribute to overide the config setting, but it doesn't.
Feb 18 '09 #6
Frinavale
9,735 Recognized Expert Moderator Expert
Thinking about your problem I think I know what's going on.

You would think that because the exception would be caught within the page error, that the redirect would be executed before the exception is bubbled up to the application level which is handled by the web.config.

But apparently this isn't happening.
I think that it's because you aren't actually trapping the exception and dealing with it.
Instead it's left to bubble up to the application level which handles the exception for you before the page can be sent to the browser.

What you probably should do is implement a method that handles the Page Error event instead of (or maybe along with) using the ErrorPage property. In this event, you can handle the error and redirect the user to the page you desire and this should prevent.

-Frinny
Feb 18 '09 #7
Paxxer
22 New Member
Hmm..

What if I restate the question.

errorPage="~/Errors/ItNeverGoesHere .aspx"

What setting in the config file should I make, and where can I raise an error, where would I clear the error to expect to see the page
"ItNeverGoesHer e.aspx"
Feb 18 '09 #8
Frinavale
9,735 Recognized Expert Moderator Expert
I'm really not familiar with the ErrorPage property.

Try something for me, leave your errorPage="~/Errors/ItNeverGoesHere .aspx" and add a method that handles the Error event for the page. See if it goes to the "ItNeverGoesHer e.aspx" page.

If this doesn't work, try clearing the error from the server using the Server.ClearErr or() in the Error event for the page....

I don't know how to implement it in such a way that it gets to the "ItNeverGoesHer e.aspx" page using the ErrorPage property because I've never used this property.

I'm interested in knowing if this works...
Feb 18 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1220
by: Daniel | last post by:
Hi, I have just a question: I need when a error ocurrs on my page, the error page that I defined be oponed. Just setting errorPage="ErrorPage1.aspx" in my page will work, rigth? or I'm making a mistake, because I doesn't work and the page crashed showing the message error. I need your support, thanks.
3
2028
by: Michael | last post by:
Hello, I'm using Web Matrix and tried to add ErrorPage like this: <%@ Page Language="C#" Debug="true" ErrorPage="hello.aspx" %> I thought this would trap unhandled exceptions and redirects to hello.aspx; it does not. Help. Thanks.
1
1044
by: Daniel | last post by:
How can I get in my custom ErrorPage the error message from the page that produced the error ?? This is just for displaying the error.
1
1193
by: Lars Netzel | last post by:
Hey! I use a custom error page in my solution, ErrorPage.aspx. Which I have styled so it goes well with the rest of the appliction... it's currently all static... Is there anyway in that page to actually access the error messages and infroamtion given by the IIS? To at least give the user feedback (to forward to the suport or something) on what page it was who gave the error and what Rownumber in that page?
2
1107
by: Jeff Robichaud | last post by:
Hi, It is said the ErrorPage property of System.Web.UI.Page defines the target page where the browser will be redirected when un unhandled exception occurs. Doesn't seem to work...well it works fine at the application level (using web.config) but I thought that we could do it at the page level too ?? Maybe I misunderstood something...
2
1503
by: ad | last post by:
Hi, I use the setting below in Web.config <customErrors mode="On" defaultRedirect="~/ErrorPage/GenericErrorPage.aspx" /> How could we get error statusCode when GenericErrorPage is load?
2
1737
by: gary.goodwin | last post by:
HI I am trying to understand Attribute usage. For example the class SerializableAttribute is a class correct? So why when it is actually u sed the "Attribute" portion of the name is dropped. The sam is true of the AttributeUsageAttribute class and on and on. I don't get it. Gary
1
1294
by: banjuu | last post by:
Hi all, i need to add errorpage in every jsp page in my project.can any one provide errorpage tht should display error occurred. need very urgent......plz help me yaar
18
6798
by: Gabriel Rossetti | last post by:
Hello everyone, I had read somewhere that it is preferred to use self.__class__.attribute over ClassName.attribute to access class (aka static) attributes. I had done this and it seamed to work, until I subclassed a class using this technique and from there on things started screwing up. I finally tracked it down to self.__class__.attribute! What was happening is that the child classes each over-rode the class attribute at their level,...
0
9953
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10868
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9588
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7137
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5808
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6009
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4231
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3242
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.