我正在做php的在线测验应用程序.我想在回到考试时限制用户.我尝试过以下脚本,但它会停止我的计时器.我该怎么办请建议我.我已经包含了源代码.计时器存储在cdtimer.js中
<script type="text/javascript">
window.history.forward();
function noBack()
{
window.history.forward();
}
</script>
<body onLoad="noBack();" onpageshow="if (event.persisted) noBack();" onUnload="">
Run Code Online (Sandbox Code Playgroud)
我有考试计时器,它从mysql数据库中获取考试时间,并相应地启动计时器,当我把代码禁用后退按钮时它停止.会是什么问题.
提供的防伪令牌适用于用户"",但当前用户为"xxxx".
我已经按照每一个解决方案来摆脱这个错误而没有任何成功:
这是场景:我在浏览器选项卡中打开了2个单独的登录选项卡A选项卡B:1.我在选项卡A中登录我的站点2.然后尝试登录选项卡B
然后发生上述错误
我的C#web MVC登录视图有:
v class="col-md-4 col-md-offset-4">
<form class="form-signin" role="form" action=@Url.Action("Login", "Account") method="POST" id="signInForm">
@Html.AntiForgeryToken()
<div class="form-group">
<label for="loginEmail">Email</label>
<input type="text" id="loginEmail" name="loginEmail" class="form-control" placeholder="Email address" >
</div>
<div class="form-group">
<label for="loginPassword">Password</label>
<input id="loginPassword" type="password" name="loginPassword" class="form-control" placeholder="Password" >
</div>
<button class="btn btn-lg btn-primary btn-block main-btn" type="submit">Sign in</button>
<div>
<br>
<a href="@Url.Action("Index","GettingStarted")">Register</a><br>
<a href="@Url.Action("ForgotPassword","Account")">Forgot your password?</a>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我的帐户控制器是这样的:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model)
{
if (ModelState.IsValid)
{
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个错误?