Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 157461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:30:30+00:00 2026-05-11T10:30:30+00:00

If I have an application running on ASP.net and I have debug and stacktrace

  • 0

If I have an application running on ASP.net and I have debug and stacktrace enabled in web.config, I get a really nice Error Screen telling me exactly which code caused the error.

Sadly on a live system where debug is set to false, the yellow screen of death is quite unhelpful, even with stack trace enabled, it does not show the line where the error happened (which seems obvious since there should be no debug information).

I just wonder if there is a way to get a good information about an error without having to enable debug=true in the web.config file. It does not have to be an improvement on the Yellow Screen, I can also wrap the code that I suspect to offend in a try..catch block, but then inside the catch block, is there a way to get to the actual code that caused the error?

As you may suspect, this is for a situation where an error only occurs in production and no remote debugger is available 🙁

Edit: This is concerning ‘normal’ exception, like System.ArgumentOutOfRangeException. Littering the code with logging is something I would like to avoid if there is a better way just to get more information where the Exception actually occured.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T10:30:30+00:00Added an answer on May 11, 2026 at 10:30 am

    The first thing I’d do when faced with this would be to add a global exception handler to the global.asax, for example:

        protected void Application_Error(object sender, EventArgs e)     {         Exception ex = Server.GetLastError();         Log.WriteException(ex);   // this is your code     } 

    You can also do something like this on the page level, but I think you’re better off doing it at the application level. When you write out the exception to the log you can also write out more information to help you recreate the error, such as the request parameters or session information.

    Another good practice is add a section like this to your web.config:

      <customErrors mode='On' defaultRedirect='error.html'>     <error statusCode='500' redirect='500.aspx'/>     <error statusCode='404' redirect='404.aspx'/>     <error statusCode='403' redirect='403.aspx'/>   </customErrors>  

    This will show the error.html on all unknown errors, and show the appropriate pages you’ve defined for some specific errors where you can give the user more information as to how to resolve the error or help them find what they’re looking for.

    Error handling in asp.net is a pretty big topic, but this should be a good starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a ASP.Net 2.0 web application up and running with the server in
I have a web application developed with ASP.net and C# that is running on
I'm developing an ASP.NET application which needs Windows Authentication. I have the web.config set
I have VS2005 and I am currently trying to debug an ASP.net web application.
We have a ASP.Net web application running in Visual Studio 2010 that is targeting
I have an ASP.NET 4.0 MVC web application running on IIS 6.0 with a
we have an ASP.net web application running on IIS7. We have multiple users, but
We have an ASP.NET application running at a customer site that uses ActiveDirectory for
I have a website running a basic ASP.NET application that is mostly used from
We have a web application written in ASP.NET 3.5. In it, we access a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.