If I use a GlobalHtmlErrorHttpHandler (e.g. this.GlobalHtmlErrorHttpHandler = new RazorHandler(“GlobalErrors.cshtml”) and I have an error in the Razor of my view then the output from my GlobalError handler will be duplicated (aka, I see everything twice).
The Razor error I am testing is an opening brace without a closing brace.
If I remove the GlobalHtmlErrorHttpHandler then the Error Response is displayed by the default HTML handler.
I tested this by:
- setting up the Razor Rockstars sample
- adding a GlobalErrors.cshtml
- adding the line ‘this.GlobalHtmlErrorHttpHandler = new RazorHandler(“GlobalErrors.cshtml”);’ to the configure method
- adding invalid Razor to Rockstars.cshtml (I remove the first closing brace).