I've got an ASP.NET 4 site on which I want to allow people to put '<' in their password. However, .NET gets in the way by blocking (what it sees as) an attempt to put HTML in a form field. I know I can turn off input validation entirely, but I only want to turn it off for this one field. Does anyone know an easy way to do that?
This is now possible with .NET 4.5.
Update your Web.config:
<httpRuntime targetFramework="4.5" requestValidationMode="4.5" />
Then set ValidateRequestMode="Disabled"
on your password controls:
<asp:YourControl id="YourControl" runat="server" ValidateRequestMode="Disabled"/>
Note - after updating web.config, you might run into the error WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for 'jquery'.
See ASP.Net 2012 Unobtrusive Validation with jQuery for more info on that.
More info on RequestValidationMode 4.5: requestValidationMode 4.5 vs 2.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With