SimpleUser
SimpleUser

Reputation: 1351

IIS Session timeout and Forms Authentication loop

I seem to have a problem with timeouts and forms authentication loops in my application. The application is MVC3 based and is AJAX heavy. I find that even when a user is continuously working on the application and not being idle, sometimes they get kicked out and then forms authentication goes into a redirect loop with a 302 error.

The application is hosted with a provider who tells me they have increased the session timeouts to 60 mint. My web.config setting for the application is as follows.

<authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" cookieless="UseCookies" slidingExpiration="true"/>
    </authentication>

Why would I be getting the session timeouts? Is there any setting I can check up/change to stop this happening?

Thank YOu,

Upvotes: 2

Views: 3201

Answers (1)

SimpleUser
SimpleUser

Reputation: 1351

I finally figured out what was happening. Firstly, I had a Session filter on my base controller, that was catching session timeouts and redirecting it to Account/LogOn. Removing this took out the redirect loops.

I also changed my code to NOT use Session variables, to get around the issue of frequent session timeouts. And this has now been resolved. I hope this helps anybody else out there struggling with similar issues. Do remember and check for any kind of custom attribute filters you may be using in your code.

Upvotes: 3

Related Questions