MVC4 – After session has timed out – error page rendered inside the partial view. redirection has not happing.

Hi All,

On the Partial view calling ajax post – if the session has timed out its not redirecting the page , but the redirecting page rendered inside the Partial view.

Whats the best way to handle session time out.

Used authorization filter on the controller.

Thanking  to All.

Rather than returning a redirect action from your action, just raise an exception instead.  If you’re using jQuery ajax calls then add an error function and in that error function do a windows.location.href to a page you want to direct the user to.

Hi Saravanan,

Thanks for your post.

According to your description,

Saravanan T

MVC4 – After session has timed out – error page rendered inside the partial view. redirection has…

I agree with what  AidyF said.

Saravanan T

Whats the best way to handle session time out.

You can try to  use ActionFilter Attribute,override  OnActionExecuting,please check this:

#Handling Session and Authentication Timeouts in ASP.NET MVC

http://markfreedman.com/index.php/2012/02/28/handling-session-and-authentication-timeouts-in-asp-net-mvc/

Hope this can be helpful.

Best Regards,

Eileen

Leave a Reply