How Can I Show Detailed ASP Errors?

You've hit an error on your website. The browser shows you a vague, unhelpful message — something like "500 Internal Server Error" — and absolutely nothing about what actually went wrong. Sound familiar?

This is Windows Server behaving exactly as designed. By default, IIS hides the details of application errors from anyone viewing your site in a browser. It's a sensible security measure in production — you don't want visitors (or anyone else) seeing stack traces, file paths, or database details. But when you're trying to debug something, that same protection becomes genuinely frustrating.

Here's how to turn on detailed error messages so you can actually see what's going wrong.

The Fix: A Small Change to web.config

You don't need to touch IIS settings directly. The cleanest way to enable detailed errors is by adding a few lines to your site's web.config file. If you don't already have one, you can create it in the root directory of your website.

Add the following configuration:

xml

<configuration>
    <system.webServer>
        <httpErrors errorMode="Detailed" />
    </system.webServer>

    <system.web>
        <customErrors mode="Off" />
    </system.web>
</configuration>

Save the file, refresh the page that was throwing the error, and you should now see the full error details directly in the browser — stack trace, line numbers, and all.

What These Settings Actually Do

httpErrors errorMode="Detailed" This tells IIS to stop swapping your real error for a generic error page. Instead, it sends the full technical details — HTTP status information, the specific error, and where in the code it originated — straight to the browser.

customErrors mode="Off" This one targets ASP.NET specifically. By default, ASP.NET has its own layer of custom error handling that intercepts errors before they reach the browser. Setting this to Off disables that layer, so the raw error message gets through unfiltered.

Together, these two settings strip away the safety net that hides errors and replace it with full transparency — which is exactly what you want when you're debugging.

When It's Safe to Use This

Detailed error messages are genuinely useful, but they need to stay in the right environments.

Use them when you're:

What you should never do is leave these settings enabled on a live, public-facing website. Detailed errors can expose things like server file paths, database connection strings, software versions, and internal code structure — information that's very handy for a developer and equally handy for someone trying to exploit your application.

Turning It Off Again When You're Done

Once you've identified and fixed the issue, put the safeguards back in place. Update your web.config like this:

xml

<configuration>
    <system.webServer>
        <httpErrors errorMode="DetailedLocalOnly" />
    </system.webServer>

    <system.web>
        <customErrors mode="RemoteOnly" />
    </system.web>
</configuration>

With these settings, detailed errors are only visible when accessing the site from the server itself — remote visitors see a generic error page instead. It's a good middle ground that keeps debugging possible without exposing anything sensitive to the outside world.

If you want to go a step further, configure IIS to log detailed errors server-side rather than displaying them in the browser at all. That way you get the diagnostic information you need without any risk of it leaking out.

Conclusion

Seeing generic error pages is IIS protecting your site — but it makes debugging a pain. Drop the web.config snippet above into your site root, and you'll get full error details in the browser straight away. Just remember to switch it back off once you're done. Detailed errors are a great tool in development; they're a liability in production.

Share