ASP.NET 多视图步骤,在最后一步捕获用户在浏览器中点击后退按钮
我构建了一个多视图表单,有 3 个步骤。
在最后一步中,我只是显示一个确认屏幕并设置此变量。
//Set Session Variable to remember registration is completed
Session["CodeProcessed"] = "CodeProcessed";
在我执行插入数据库之后。
然后在我的页面加载中我将
if (Session["CodeProcessed"] == "CodeProcessed")
{
Session["CodeProcessed"] = "";
MultiView1.ActiveViewIndex = 0;
Response.Redirect("register.aspx");
}
用户发送回开始。例如,如果他们到达步骤 3 并在确认屏幕上单击“刷新”,他们就会返回开始,这很好。但是,如果用户到达步骤 3 并单击浏览器按钮返回,则该页面会正常加载,并且步骤 2 会再次加载。我怎样才能阻止它这样做并重定向回步骤 1 ?
I build a multiview form which has 3 steps.
On the last step I simply show a confirmation screen and set this variable.
//Set Session Variable to remember registration is completed
Session["CodeProcessed"] = "CodeProcessed";
After I perform my insert into the database.
Then in my pageload I have
if (Session["CodeProcessed"] == "CodeProcessed")
{
Session["CodeProcessed"] = "";
MultiView1.ActiveViewIndex = 0;
Response.Redirect("register.aspx");
}
Sending the user back to start. So for example if they get to step 3 and click refresh on the confirmation screen they go back to start which is fine. But if the user gets to step 3 and clicks back in the browser button that page loads fine and step 2 loads again. How could I stop it from doing this and redirect back step 1 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 asp.net 中的
History
控件来确保“后退”按钮引导至您希望用户访问的视图You can use the
History
control in asp.net to make sure Back button leads to the View you wish user to be taken to