Archive for tag: Form-Validation

Potentially Dangerous Request.Form Value Was Detected From The Client

Hi Everyone,

I was trying to create new RichTextEditor in one of my project and was using textarea or <asp:Textbox ……> and it has some of the scripts that I needed to use and then what happened was that I couldn't do it because it had an script and some of the Html elements so then I got error like "Potentially Dangerous Request.Form Value Was Detected From The Client" here below is an error:

First-Step

To deal with this you have to disable ValidationRequest feature. You have to disable this because validation is done by ASP.NET while executing code by disabling it will not validate, means will not check for scripts and html into inputted script. <%@Page directives ValidationRequest="false", Or you can disable it for enter application from web.config file. 

<configuration>
    <system.web>
        <pages validateRequest="false" />
    </system.web>
</configuration>

 If you are running on .NET framework 4.0 make sure you have to add requestValidationMode as well

<configuration>
    <system.web>
        <httpRuntime requestValidationMode="2.0" />
    </system.web>
</configuration>

Then it would solve your problem and it has solved my problem as well.

I hope it would have solved your issue if you looking for same issue. Also, don't forget to share and like on social media.

Thank you,