Reputation: 4122
I have my Error.aspx being loaded upon a server error but the problem is it has no information on it and I can't track down how or why it is being loaded. I searched my project for "Error.aspx" and nothing is coming up. How do you get a stack trace or something that is half way useful?
Thanks
Upvotes: 4
Views: 3704
Reputation: 5753
Look in your web.config file for the <customErrors>
element.
It probably specifies defaultRedirect="Error.aspx"
and mode="On"
. Set mode="Off"
or create an error page.
Read the MSDN docs: customErrors Element (ASP.NET Settings Schema)
Note: It is also possible that the <customErrors>
element is being inherited from a .config file higher up at global server level (one of the root web.config files or machine.config). Check these if you cannot find <customErrors>
in your application web.config file.
Upvotes: 2
Reputation: 16838
Are you using a HandleError attribute on any of your controllers? If this attribute is present, when an unhandled exception occurs ASP.NET MVC will look for a view named Error.aspx in the controller's view folder. If it doesn't find one it then looks in the shared view folders. If you have default controllers in your project (ie. HomeController, AccountController) then you'll notice that they have the attribute.
Upvotes: 4