Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

retrieving Server.GetLastError

Posted on 2002-05-29
4
Medium Priority
?
217 Views
Last Modified: 2007-12-19
apparently, the <customErrors> feature of web.config flushes the contents of Server.GetLastError.

so on whatever error page the user gets redirected to, that page cannot display the contents of Server.GetLastError!

am i correct in saying this, or is there a way around this so i can capture the contents of Server.GetLastError?

or maybe i am doing something wrong?

thanks...
0
Comment
Question by:loyaliser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 23

Accepted Solution

by:
naveenkohli earned 400 total points
ID: 7042795
loyaliser,
You are not doing anything wrong. I came across this problem few months ago. I reported it to MS but nver got any reponse from them. It very well could be a bug. FOr now you can make sure that you provide try/catch handler arounf every call that is capable of throwing exceptio. And catch the exeptions there and then redirect the user to proper error page. And for HTTP 400 code sereies you will add <error> tag under <customErrors> and then you get redirected there.
Other than that, there is nosolution I have found so far.

Naveen
0
 
LVL 1

Author Comment

by:loyaliser
ID: 7042819
well, the only solution i can think of is to use the Application_Error method in Global.asax.

capture the Server.GetLastError data... do whatever you need to with it, then force a redirect to a standard error page (e.g. AllErrors.aspx), and within that page handle the type of error that occured by reading the URL variables (can send them through the redirect when it happens).

the only thing that i dislike about this method is that it prevents you from using the "cool" <customErrors> tag feature.

which i guess is not much of a big deal...

this leads to a QUESTION:

how can you capture the HTTP error code (e.g. 400, 500 etc.) that occured in Application_Error?

is there another Server method for that?

thanks...
0
 
LVL 23

Expert Comment

by:naveenkohli
ID: 7042857
These errors have nothing to do with ASP.Net or ASP. 500 series errors are ASP specific errors. they don't get thrown in ASP.Net pages. You will get exceptions and that your handling in Application_error. For HTTP status errors, you have to rely on <error> redirections or if your application has specific requirements for these errors, then you will writr your own ISAPI filter and then handle it there.
0
 
LVL 1

Author Comment

by:loyaliser
ID: 7042869
the plot thickens... thanks!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question