从ReturnUrl

时间:2018-12-31 21:47:40

标签: asp.net-mvc-5.2

例如,如果用户要转到登录页面并重定向到登录页面,则该网址将如下所示

https://OurDomain.com/HA5/Secure/Login?ReturnUrl=%2FHA5%2FSecure%2FLanding%2F

我尝试了各种方式来获取查询字符串

Request.QueryString(“ ReturnUrl”)不返回任何内容

System.Web.HttpContext.Current.Request.Url.PathAndQuery不包含查询字符串。

我想念什么?

谢谢

1 个答案:

答案 0 :(得分:0)

还有很长的路要走,但是我唯一能找到的方法就是通过jQuery传递值

GTK

控制器(值另存为会话)

 var vPath = window.location.href;
jQuery.ajax({
            url: '@Url.Action("ReturnURL", "Login")',
    type: 'POST',
    data: { FullURL: vPath },
    success: function (response) {
        if (response.indexOf('Invalid') >= 0) {
            //They got here from an old link
            window.location.href = '/secure/redirect/';
        }
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        ModalError(textStatus + " - " + errorThrown);
    }



})
相关问题