What exceptions will be detected by Microsoft.Owin.Diagnostics.ErrorPageExtensions.UserErrorPage

I got the demo code from http://blogs.msdn.com/b/webdev/archive/2013/11/22/debugging-owin-app-or-framework.aspx and it shows a sexy error page.

app.UseErrorPage(new ErrorPageOptions() { //Shows the OWIN environment dictionary keys and values. This detail is enabled by default if you are running your app from VS unless disabled in code. ShowEnvironment = true, //Hides cookie details ShowCookies = false, //Shows the lines of code throwing this exception. This detail is enabled by default if you are running your app from VS unless disabled in code. ShowSourceCode = true, }); app.Run(async context => { throw new Exception("UseErrorPage() demo"); await context.Response.WriteAsync("Error page demo"); }); } 

However, if I throw an exception in the Controller action, the error page will not be displayed, and I still see YSOD.

So, I want to know which exceptions will be caught by UseErrorPage? Do I need additional settings to work?

+7
owin katana
source share
1 answer

By controller action do you mean MVC? MVC does not start directly on OWIN, so Asp.Net first sees an exception and shows you YSOD. Katana ErrorPage can only show exceptions that occur in the OWIN pipeline.

+7
source share

All Articles