我正在努力在登录时出现登录对话框。我需要做的是当用户使用内置的 MVC3 身份验证控件登录时,我需要它弹出一个对话框,吐出一些条款和协议,并说“如果你点击接受,你同意上述内容”。我目前有,但是当我点击取消时,该网站仍然会登录。这是我的代码:
<fieldset>
<legend>Login</legend>
<div class="editor-label">
@Html.LabelFor(model => model.userName)
</div>
<div class="focus">
<div class="editor-field">
@Html.EditorFor(model => model.userName)
</div>
</div>
<div class="editor-label">
@Html.LabelFor(model => model.passWord)
</div>
<div class="editor-field">
@Html.PasswordFor(model => model.passWord)
</div>
<p>
<input type="submit" value="Login" name="btnLogin" id="btnLogin" />
</p>
@Html.ValidationSummary(true)
</fieldset>
还有我拥有的Javascript:
<script type="text/javascript">
$(function () {
$("#btnLogin").click(function () {
var answer = confirm("Unauthorized access or use of the web content is prohibited.\n" + "By clicking 'OK', you have agreed to the above conditions");
if (answer) {
}
else {
$(this).dialog("close");
}
});
});
</script>
当用户点击对话框上的取消并在他们点击确定时继续登录时,我将如何让它在登录时取消 HttpPost?
非常感激!!