Reputation: 416
I am looking for a way to catch an error caused by an incorrect web.config file.
It looks like void Application_Error(object sender, EventArgs ev)
is only called after validating the config file and is never reached.
Example error:
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
This error happens when the application's App pool is set to framework 2.0 instead of 4.0
When this error happens I want to redirect to a specific page with screenshots to explain how to change the App pool.
Is it possible to catch this error in global.asax?
Upvotes: 1
Views: 202
Reputation: 2251
try this solutuin
<configuration>
<system.web>
<customErrors defaultRedirect="GenericError.htm" mode="RemoteOnly">
<error statusCode="500" redirect="InternalError.htm"/>
</customErrors>
</system.web>
</configuration>
for more detail http://msdn.microsoft.com/en-us/library/h0hfz6fc(v=vs.71).aspx
Upvotes: 2