I have this scenario:
A user comes to my site and followes a link, wich doesnt exists anymore, he should be redirected to a custom errorpage. (that works)
If a user does something, that throws an error, he should see the Stacktrace and the real Errorpage.
This is my current Web.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<customErrors>
<error statusCode="404" redirect="/errors/404.htm" />
</customErrors>
<compilation debug="true" strict="false" explicit="true" />
</system.web>
</configuration>
with this configuration, a 404 will be redirected to the right site, but a HTTP 500 will be shown as following:
Server Error in '/' Application
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web [.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".
[...]
But in this case i want to show the stacktrace.
How can i do this?
Note: We're on Linux with a Mono <- FastCGI -> Lighttpd construction.
In the following web.config entries, a not found (404) condition will send a user to PageNotFound.aspx
Use mode="Off" and everyone (local and remote users) will see error details.
Use mode="RemoteOnly" and local users will see detailed error pages with a stack trace and compilation details. Remote users with be presented with the GeneralError.aspx page
Ray Van Halens Answer is correct, but this was not the actual problem.
The reason for not showing stacktrace is a bug in mono itself. There is no other way then write an own error page where the stacktrace is dispayed.