473,756 Members | 6,098 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetLastError in defaultRedirect page?

Hi

I want to know if it's possible to user Server.GetLastE rror() in my AppError.aspx below? The GetLastError is not available here and returns null. I'm using Application_Err or event to send an email, but I also want to create a custom error page in the AppError.aspx that displays some of the error message. Do I have to preserve the error message in the Application_Err or event

<customErrors mode="On" defaultRedirect ="AppError.aspx "/>

Thanks, Dave.
Nov 18 '05 #1
1 2409
Server.getlaste rror will be null during that time, you can use
server.lasterro r only at Page_OnError to get the exception. So in
Page_onError, get the exception and store in session and then redirect to
your AppError.aspx . From the session get that value and display your custom
error message to the user

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Dave" <an*******@disc ussions.microso ft.com> wrote in message
news:C1******** *************** ***********@mic rosoft.com...
Hi,

I want to know if it's possible to user Server.GetLastE rror() in my AppError.aspx below? The GetLastError is not available here and returns
null. I'm using Application_Err or event to send an email, but I also want
to create a custom error page in the AppError.aspx that displays some of the
error message. Do I have to preserve the error message in the
Application_Err or event?
<customErrors mode="On" defaultRedirect ="AppError.aspx "/>

Thanks, Dave.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1648
by: SilverlineDesign | last post by:
I am having trouble using Server.GetLastError() on my asp.net pages. I defines a standard error page in my web.config to handle all site errors, but the page that is supposed to handle the error creates an error itself. Whenever I try to retrieve the last made error with Server.GetLastError() will retrieve a null result, so if I try to print out something like Server.GetLastError().ToString() the page will spit out a nullreference exception....
1
1709
by: Brendan Erwin | last post by:
Looking for some clarification here. I'm considering using HttpServerUtility.GetLastError in a standard errorhandler for all my pages. (Inherits System.Web.UI.Page and overrides OnError.) My concern is that I think there MAY be a timing issue with the GetLastError method as it is a method of the HttpSERVERUtility class. When an exception is thrown within a page and triggers the OnError method, how am I guaranteed that the exception...
1
2114
by: Darrin J Olson | last post by:
I am having trouble with the page redirecting for handling errors. I have the following in my Web.config file: <customErrors mode="On" defaultRedirect="Errs/AppError.aspx"> <error statusCode="404" redirect="Errs/NotFound.aspx"/> </customErrors> When I hit an error, it redirects me to the Errs/AppError.aspx page, and it shows the original page that generated the error as a parameter in the URL, but it doesn't show the contents of the...
2
2135
by: Lars Netzel | last post by:
I'm trying to make my own custom error page... but when using Try lblErrormessage.Text = Server.GetLastError.Message lblErrormessage.Text += "<br>" & Server.GetLastError.StackTrace lblErrormessage.Text += "<br>" & Server.GetLastError.Source Catch ex As Exception
6
4603
by: José Joye | last post by:
Hello, I'm currently reading the MS Developing Web applications with c# (and VB.net). In the chapter related to Error management, there is a sample about "Page-Level Error Pages" eg: In my form: ========
1
269
by: hansiman | last post by:
In my web.config I have: <customErrors defaultRedirect="/error.aspx" mode="On"> in error.aspx I try to get the last error and do something with it: Dim ex As Exception = Server.GetLastError I get Nothing (ex = Nothing)
1
2449
by: robertlair | last post by:
I am having issues with a production server with the GetLastError() method. Here is what I am doing: Application_Error on Global ASAX: Note: I am doing it this way (with ClearError) because while researching, someone on a post said that Session state would not persist unless I cleared the error... didn't make sense, but it also didn't work before I put this in there too.
2
4263
by: Richard Coltrane | last post by:
Hi there, Ive just implemented some application level exception handling in ASP.Net 2.0. I deliberately set up a null reference error in my code to see how this would be handled. Sure enough the applicationOnError code runs in Global.asax and hands it off to my custom error page but theres no info in the exception returned by Server.Getlasterror. The type of this exception is just HttpUnhandledException (which is obvious,
4
6013
by: =?Utf-8?B?TWFyaw==?= | last post by:
I think I am missing something about how to redirect to a certain page when 404 errors occur. I want to redirect to a generic pagenotfound.aspx page. I have the following in web.config: <customErrors mode="RemoteOnly" defaultRedirect="/misc/pagenotfound.aspx"> </customErrors> However, when I enter a non-existent URL I just get the default Page Not Found error page - my pagenotfound.aspx file is not invoked (it works fine if I enter...
0
9454
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...
0
9707
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8709
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...
1
7242
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6533
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
5139
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...
1
3804
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
3352
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2664
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.