我的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(“secure /”)无效。
任何帮助将不胜感激。
答案 0 :(得分:1)
您必须处理来自javascript的重定向。由于您没有进行回发,因此服务器永远无法完全控制页面。