Try our conversational search powered by Generative AI!

Sometimes AccessDeniedException and sometimes not - how to troubleshoot?


Part of our website is restricted only to visitors who've logged in.

Sometimes when they try to login an EPiServer.Core.AccessDeniedException is thrown. However, sometimes they will succeed in logging in just by switching browser or computer. And even weirder is the fact that I have never been able to re-create the exception on my local machine.

Some facts:

- We are running EPiServer 7.1

- We are using a custom membership provider

- The following text is from the log-file:

2016-09-22 11:04:26,907 [79] ERROR EPiServer.Global: 1.2.5 Unhandled exception in ASP.NET
System.Web.HttpUnhandledException (0x80004005): Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> EPiServer.Core.AccessDeniedException: Access denied
   at EPiServer.PageBase.GetPage(PageReference pageLink, ILanguageSelector selector)

In the code we are actually calling GetPage in the following way: PageData myPageData = GetPage(myPageReference);

Any advice on how to troubleshoot errors like the one above?

Sep 22, 2016 14:35

Might be session timeout? Then user refresh page and gets redirected to login..

Might also be that you have built some custom authorization?

Custom login page? Do you redirect after login?

Do you filter all menues etc on access using Episerver.Filters....?

Might want to turn on additional logging and try to catch the issue. Only happens on login?

Do you store anything extra in different cookie so session times out but they have another cookie that leaves them partially logged in...

Sep 22, 2016 17:03
* 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.