mtmurdock
mtmurdock

Reputation: 13062

MVC3: Controller action that doesn't refresh session

I need to create and action that returns whether or not the user's session has expired. The problem is that requesting any action will refresh the user's session timeout. So, I need this action to NOT refresh the timeout.

Is there some way to make a controller action that has access to the session, but does not refresh the timeout?

Upvotes: 2

Views: 1072

Answers (1)

mtmurdock
mtmurdock

Reputation: 13062

Figured it out. We built an http module to read the forms auth ticket which could be accessed at site.com/.formsauthticket. By handling it at this level, it did not trigger the session at all. I'm afraid I cannot provide code here but we set the module to return the number of milliseconds till the session expired. We then used this number to make some client-side timers.

We based our solution on an answer to a different question found here. Hope this helps someone else!

Upvotes: 1

Related Questions