SaaS CMS has officially launched! Learn more now.

Permissions for functions doesn't show error



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 :)


Jan 12, 2015 17:11

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.

using EPiServer.Security


if (PrincipalInfo.Current.IsPermitted(Permission.DetailedErrorMessage))

If user is permitted you can use exception manager to render detailed error page:

Jan 12, 2015 21:24

Ohhhh Great!!!!

Thanks a lot!! 

Jan 13, 2015 10:36

And how should I get the error message in the controller action? :)

Jan 13, 2015 14:49

I think you have to check Server.GetLastError() or similar.

Jan 13, 2015 15:53

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 :)

Jan 13, 2015 16:13

investigate AllErrors collection..

Jan 13, 2015 17:33

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 :)

Jan 13, 2015 17:37

Try to go upwards from EPiServer.Global.OnError event handler :)

Jan 13, 2015 17:40

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)
                if (PrincipalInfo.Current.IsPermitted(SystemPermissions.DetailedErrorMessage))
                    var httpException = exc as HttpException ?? new HttpException(500, StringConstants.InternalServerError, exc);
                    switch (httpException.GetHttpCode())
                        case 403:
                            Response.Redirect("~/403.html", true);
                        case 404:
                            Response.Redirect("~/404.html", true);
                            Response.Redirect("~/500.html", true);


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 :)

Edited, Jan 14, 2015 13:58
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.