0

ログイン用の 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/") が機能していないことです。

どんな助けでも大歓迎です。

4

1 に答える 1

1

JavaScript からのリダイレクトを処理する必要があります。ポストバックを行っていないため、サーバーがページを完全に制御することはありません。

于 2013-02-12T20:26:29.560 に答える