Request Validation asp.net

1

I have a TextBox that uses the ckeditor text editor. When I run the method to save the information, it gives an error

  

A potentially dangerous Request.Form value was detected from the client (ctl00 $ ContentPlaceHolder1 $ fTxtConteudo="

sdgfdsgdg

  ").   Description: ASP.NET has detected data in the request that is potentially dangerous because it might include HTML markup or script. The data might represent an attempt to compromise the security of your application, such as cross-site scripting attack. If this type of input is appropriate in your application, you can include it in a web page to explicitly allow it. For more information, see link .   Exception Details: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client (ctl00 $ ContentPlaceHolder1 $ fTxtConteudo="

sdgfdsgdg

  ").

Already put the code in < @ Page validateRequest="false"% > and it still did not work. I want to apply this permission only on this page, not the entire site through web.config

Remembering that I'm using ASP.NET

    
asked by anonymous 08.07.2015 / 16:49

2 answers

1

To do the work for ValidateRequest in .Net 4.0 or higher, you will need to add the following configuration in web.config , section <system.web> :

<httpRuntime requestValidationMode="2.0" />

Once added, you can set validateRequest=false in web.config or in Page directive.

    
08.07.2015 / 17:27
0

In the directive of your page, put the following code by setting the ValidateRequest to false .

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="StackOverflowWEB._Default" ValidateRequest="false" %>
    
18.02.2016 / 17:05