简体   繁体   English

允许使用特殊字符输入密码

[英]Allow special characters for password

In my MVC2 site if a user enters lt/gt signs in a password box an exception is thrown because of "potentially dangerous..". 在我的MVC2站点中,如果用户在密码框中输入lt / gt符号,则会由于“潜在危险..”而引发异常。 ValidateInput(false) on my controller solves it but for something so simple (not html passing) yet needs to be protected what is a better alternative? 我控制器上的ValidateInput(false)解决了这个问题,但是对于一些简单的操作(不是通过html传递)却需要加以保护的是什么更好的替代方法? I've briefly looked at http://wpl.codeplex.com/ but it also seems overkill 我已经简短地看过http://wpl.codeplex.com/,但这似乎也太过分了

Thoughts? 有什么想法吗? Your solution? 您的解决方案?

use Javascript onsubmit event and escap your inputs before posting it to the server. 使用Javascript onsubmit事件并在将其发布到服务器之前转义您的输入。 that will allow you to do what you want. 这样您就可以做自己想做的事。

You can unescap the data at server side as well. 您也可以在服务器端对数据进行转义

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM