Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
JavaScript
$('.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
C#
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 
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900