【问题标题】:Response.Redirect not evaluatingResponse.Redirect 未评估
【发布时间】:2013-02-12 20:13:06
【问题描述】:

我的 Default.aspx 页面上有以下用于登录的 ajax 脚本

$(document).ready(function () {
    $('#UserLogin').submit(function (e) {
        $.post("LoginApp.aspx?formpost=Login", { UserID: $("#UserID").val(),
            UPass: $("#UPass").val()
        },
        function (response) {
            if (response === "failed") {
                $("#ErrorDiv").html(response).show();
                // LocalStorage.set('Error', response);
            }
        });

        e.stopPropagation();
        return false;
    });
});

和下面的FormAuth

 If Request.QueryString("formpost") = "Login" Then

    If App.LoginUser(Request.Form("UserID").Trim, Request.Form("UPass").Trim) Then

        FormsAuthentication.RedirectFromLoginPage(Request.Form("UserID").Trim, False)
        If Request.QueryString("ReturnUrl") <> "" Then
            Response.Redirect(Request.QueryString("returnUrl"))
        Else
            Try
                Response.Redirect("secured/")     
            Catch ex As Exception

            End Try

        End If
    Else
        Response.Write("failed")
    End If
Else

    Response.Redirect(".")

End If

问题是 Response.Redirect("secured/") 不起作用。

任何帮助将不胜感激。

【问题讨论】:

    标签: asp.net ajax vb.net formsauthentication


    【解决方案1】:

    您必须处理来自 javascript 的重定向。由于您没有进行回发,因此服务器永远无法完全控制页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-24
      • 1970-01-01
      • 2017-12-02
      • 2016-11-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多