I have following problem: when my session expires and user clicks on Ajax.Actionlink, Logon page returns as partial page
I have following problem: when my session expires and user clicks on Ajax.Actionlink, Logon
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
create an ActionFilterAttribute that implements IAuthorizationFilter
and in OnAuthorization check if the user is logged out,
if he is logged out and this is an Ajax request(filterContext.HttpContext.Request.IsAjaxRequest()) – set filterContext.Result to a different result.
i return a result with HttpStatusCode.Unauthorized
so i can hook to it at the client and react accordingly
never used Ajax.Actionlink, i use jQuery for all my Ajax calls and have a global hook to catch results with error status codes