如何防止用户在URL中输入特殊字符 [英] How to prevent user from enter special character in URL

查看:223
本文介绍了如何防止用户在URL中输入特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想阻止我的网址在网址中输入特殊字符,例如



https://www.testabc.com/form/abc.aspx>(其他在aspx用户输入大于号后)



我尝试过:



我创建了自定义错误页面,如果假设在应用程序中发生任何异常,我会重定向到自定义错误页面并且会话变得清晰,但在上面的情况下,如果用户输入特殊字符会话未明确。

I want to prevent My url from entering special character in URL like

https://www.testabc.com/form/abc.aspx>(here after aspx user entered greater than sign)

What I have tried:

I have created custom error page if suppose any exception occur in application i redirected to the custom error page and session get clear but in above case if user enter special character session not getting clear.

推荐答案

最重要的是你不能阻止这个。



如果用户要弄乱地址栏中的内容那么你什么也没有可以做到防止它。他们正在执行使他们的浏览体验变差的行为。



您所能做的就是在服务器端采取行动,以免您的网站受到不利影响。输入错误。
The bottom line is you can't prevent this.

If the user is going to mess with what's in the address bar there's nothing you can do to prevent it. They are performing the action that makes their browsing experience bad.

All you can do is take action on the server side so that your site isn't adversely affected by the bad input.


这篇关于如何防止用户在URL中输入特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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