473,387 Members | 1,492 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,387 software developers and data experts.

GetLastError in defaultRedirect page?

Hi

I want to know if it's possible to user Server.GetLastError() in my AppError.aspx below? The GetLastError is not available here and returns null. I'm using Application_Error 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_Error event

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

Thanks, Dave.
Nov 18 '05 #1
1 2379
Server.getlasterror will be null during that time, you can use
server.lasterror 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*******@discussions.microsoft.com> wrote in message
news:C1**********************************@microsof t.com...
Hi,

I want to know if it's possible to user Server.GetLastError() in my AppError.aspx below? The GetLastError is not available here and returns
null. I'm using Application_Error 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_Error 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
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...
1
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...
1
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"...
2
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 ...
6
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...
1
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...
1
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...
2
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...
4
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: ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.