How can I hide line of source throwing an exception in yellow screen of death? For example, consider following screen of potential dangerous request:
In above example, source lines are not displayed. Whereas, if it is any custom written code throwing an exception, lines of error are always displayed as following:
How can I hide lines of code (similar to first image) when throwing an error?
Set the mode
attribute of the customErrors
section to RemoteOnly
in your "web.config" file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<customErrors mode="RemoteOnly" />
</system.web>
</configuration>
This enables you to see detailed errors when you are browsing the website locally on your server but does not expose detailed errors for remote visitors.
Alternatively, set it to On
instead of RemoteOnly
to completely hide detailed errors, no matter whether you are browsing remotely or locally.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With