I want to bypass my [SessionExpire] that has redirection to login. I want to bypass the attribute to execute it without logging in.
A custom attribute as shown :
public class SessionExpireAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpContext ctx = HttpContext.Current;
// check sessions here
if( HttpContext.Current.Session["username"] == null )
{
filterContext.Result = new RedirectResult("~/Account/Login");
return;
}
base.OnActionExecuting(filterContext);
}
}
//SAMPLE IMPLEMENTATION:
[SessionExpire]
public class HomeController : Controller
{
public ActionResult Index()
{
return Index();
}
//I WANT TO BYPASS THIS JSONRESULT WITHOUT GOING TO SESSIONEXPIRE
public JsonResult Result()
{
return Json();
}
}