I have a small problem. I want to see the error on the test server, and I am a part of admins in Permissions for Functions so I should see the detailed error, but since we added in the config file custom 500.html for all server errors:
I also see just that page and not the whole error.
If I add
all users get the whole errors. Is there some solution for this?
Thanks in advance :)
I think IIS (web.config) settings are overwritten and enforced before actually EPiServer can handle that.
If you really need custom 500 error page for rest of the world and for admins - show detailed view of the error, you could create a bit more complex 500 error page and behind the scene check permissions for the current user - if he/she is able to see detailed messages.
If user is permitted you can use exception manager to render detailed error page:
Thanks a lot!!
And how should I get the error message in the controller action? :)
I think you have to check Server.GetLastError() or similar.
Yeah, in the meantime I've found that but it is null.
I found this post:
I've added globalErrorHandling="Off" in episerver.config but it still gives me null. I am not sure if I should try with Context.AllErrors because the post is from 2008 :)
investigate AllErrors collection..
I tried with it but it is also null. I think that Episerver handles that error and I have to find out how.
Thanks anyway :)
Try to go upwards from EPiServer.Global.OnError event handler :)
At the end, this is how I done it:
private void Application_Error(object sender, EventArgs e)
// Code that runs when an unhandled error occurs
var exc = Server.GetLastError();
if (exc != null)
var httpException = exc as HttpException ?? new HttpException(500, StringConstants.InternalServerError, exc);
I removed the code from the web config.
I am not sure if it is the best solution but it works for now. If anybody has some better solution, please share :)
Thanks Valdis :)