模式弹出窗口在会话到期时显示登录页面 [英] Modal popup shows login page when session's expires
问题描述
我通过编辑按钮点击控制器上的ajax调用在模态弹出窗口中显示部分视图,我的控制器也装饰了属性,如果会话过期,它会重新定向到登录页面,检查会话是否到期。它工作正常,直到我清除缓存,当我点击编辑按钮它显示我的模态弹出窗口中的登录页面。以下是我的Jquery
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
推荐答案
(' .btnpopupdetails')。click( function (){
var url = 编辑;
var id =
('.btnpopupdetails').click(function () { var url = "Edit"; var id =
( this )。attr(' data-id');
(this).attr('data-id');
.get(url + ' /' + id, function (data){
.get(url + '/' + id, function (data) {
这篇关于模式弹出窗口在会话到期时显示登录页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!