Hi All, - <%@ Page Language="C#"
-
MasterPageFile="~/MasterPages/MyMaster.master"
-
errorPage="~/Errors/Error.aspx"
-
Title="This will have an Error"
-
AutoEventWireup="true"
-
CodeFile="NewError.aspx.cs"
-
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
8 1983
Is this overridden by what is in your web.config error handling?
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.
Do you have any error handling code in your web.config?
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: -
<customErrors mode="RemoteOnly" defaultRedirect="~/Errors/Error.aspx">
-
</customErrors>
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.
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
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"
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...
Sign in to post your reply or Sign up for a free account.
Similar topics |
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.
|
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.
|
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.
|
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?
|
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...
| |
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?
|
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
|
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
|
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,...
|
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...
|
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,...
| |
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |