How to deactivate ValidateRequest



  • Microsoft offers by default a way to prevent any person entering in our input box some weird character that causes harm to our website, for example any script:

    When you click the button we'll have this:

    This is good to avoid some scripts entry in a blog for example, but this is not good when you have to save in the database an auto generated password (p<!kj1fg) with this rare characters. In this case you don't need this. To deactivate this you have two ways:

    -If you need it in certain pages, add ValidateRequest="false" in the Page section:

    -If you need it in all pages, add in the web.config pages section this:

    In any of these options you need to add this in the web.config httRuntime section:

    Enjoy it!

    Original source:

    http://stackoverflow.com/questions/2673850/validaterequest-false-doesnt-work-in-asp-net-4



  • Comments



Add a Comment