I have a single-page-application in MVC4 (.NET) website. Some of the methods has permissions to specific roles.
When a user log in to the system (with cookies)
FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
everything works fine, but if the user leaves the website open and comes back after a while (at least 30 minutes I thinks) without refreshing (It's a single page application so refresh is not needed) and then tries to do something in the website - the user gets an error
"Authorization has been denied for this request."
After a refresh (F5) - everything goes back to normal.
I guess maybe the session is over or something like that. How can I fix it?
In my web.config I have these lines:
<authentication mode="Forms">
<forms loginUrl="~/" timeout="2880" slidingExpiration="true" cookieless="UseCookies" />
</authentication>