I am using code for session timeout (code comes from this link). This code generally works fine, except if user has waited long enough to hit IIS Idletime out (by default 20 minutes). Once Idletimeout is reached, because that w3wp process does not exists, it seem like this Redirect call to Home/Login goes into a long loop with 302s. Any idea how this situation can be better handled
Asked
Active
Viewed 718 times
2 Answers
1
The redirect will cause another request, so if the request is for the login page you have to let it through without doing another redirect.
Pseudo code:
if (current_request_url =! "~/Home/Login") {
ctx.Response.Redirect ( "~/Home/Login" );
}

Guffa
- 687,336
- 108
- 737
- 1,005
-
Not sure if I understand it completely, Can you update your answer with example as how to do it? – imak Feb 10 '12 at 20:41
1
Ensure this filter is not applied to your login action

Adam Tuliper
- 29,982
- 4
- 53
- 71
-
hmmm, Currently action filter is been applied via Global.asax by registering it in RegisterGlobalFilters method. Do I need to apply the attribute to indiviual controller or is there any easier way of doing it? – imak Feb 10 '12 at 21:07
-
Use guffas example or make your attribute a bit better and have an exclude attribute so you don't have to hard code names such as: http://stackoverflow.com/questions/4684150/a-way-to-exclude-action-filters-in-asp-net-mvc – Adam Tuliper Feb 10 '12 at 21:50