如何通过URL修改阻止我的Web应用程序重定向? [英] How do I prevent my web application from being redirected through URL modification?

查看:144
本文介绍了如何通过URL修改阻止我的Web应用程序重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



让我说当我在我的locahost上运行我的网络应用程序时,broswer中的网址就像〜/ Page1。



如果用户将网址从〜/ Page1更改为〜/ Page2,它们将被重定向到〜/ Page2。



我有什么方法可以防止这个网址修改?由于我需要用户能够在Page1上完成所需的操作才能进入Page2。



任何帮助都将受到赞赏。



提前致谢。

Hello guys,

Let's say when I run my web application on my locahost, and the url in the broswer is like ~/Page1.

If the user changes the url from "~/Page1" to "~/Page2", they will be redirected to "~/Page2".

Is there any way for me to prevent this url modification? Since I need the user to be able to complete the required actions on Page1 before they can proceed to Page2.

Any help will be appreciated.

Thanks in advance.

推荐答案

=>做一件事,你可以创建一些会话,当用户完成第一页的步骤时,该会话只包含有效数据。



=>在第二页加载事件中检查该会话,如果该会话有效则允许用户访问第二页,其他方面再次重定向到第一页。



相同的机制就像我们检查过用户身份验证一样,如果用户没有登录,那么我们会将他重定向到登录页面,或者如果登录则可以访问其他页面。您可以为您的解决方案创建相同的内容。
=> Do one thing, you can create some session which is only contains valid data when user has finished steps over first page.

=> check that session in your second page load event, if that session is valid then allow user to access second page, other wise redirect to first page again.

the same mechanism like we have checked user authentication, if user is not logged in then we redirect him to login page, or if logged in then can access other page. you can create same for your solution.


这篇关于如何通过URL修改阻止我的Web应用程序重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆