Hi,
how to redirect to login page is session is out?
below code is working fine when i clear cache in browser and refresh the page means it will redirecting to login, but when session is out after that when i click some button with ajax call it will not redirecting to login when session is out
below code i used
[AutorizeUser]
public class HomeController : Controller {
}
public class AutorizeUser : ActionFilterAttribute, IActionFilter
{
/// <summary>
///
/// </summary>
/// <param name="filterContext"></param>
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (HttpContext.Current.Session["UserIsLoginIn"] == null)
{
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary {
{"Controller", "Login" },
{"Action", "Index" }
});
}
base.OnActionExecuting(filterContext);
}
}