I display partial view in modal popup through ajax call from controller on edit button click, also my controller is decorated with attribute which checks for session expires or not if session expires it redirects to login page. It is working fine until i clear the cache and when i click edit button it shows login page in my modal popup. Following is my Jquery
$('.btnpopupdetails').click(function () {
var url = "Edit";
var id = $(this).attr('data-id');
$.get(url + '/' + id, function (data) {
$('#ModalPopupContent').html(data);
$('#myModal').modal('show');
});
});
Filter attribute
public void OnAuthorization(AuthorizationContext filterContext)
{
string TempEmail = Convert.ToString(filterContext.HttpContext.Session["Email"]);
if (TempEmail == "")
{
filterContext.Result = new RedirectToRouteResult("Default",
new System.Web.Routing.RouteValueDictionary{
{"controller", "Auth"},
{"action", "LogOut"},
{"returnUrl", filterContext.HttpContext.Request.RawUrl}
});
}
I don't know how to prevent login page to show in popup. It should redirect to login page. Thanks in advance
What I have tried:
I display partial view in modal popup through ajax call from controller on edit button click, also my controller is decorated with attribute which checks for session expires or not if session expires it redirects to login page. It is working fine until i clear the cache and when i click edit button it shows login page in my modal popup. Following is my Jquery