ValidateRequest = "false" doesn't work when sending HTML values

I am developing a personal blog in ASP.NET MVC 1.0. This blog app has views like Insert Post, Edit Post, etc. I need to send a string containing HTML to the appropriate controller method. This HTML value is sent from the text box.

I read what needs to be disabled ValidateRequest

directly on the attribute page ValidateRequest = "false"

or in the web.config file.

When I paste an HTML value into a textbox, I always get a "potential value" error.

How can I use ValidateRequest

to allow a form element containing HTML values ​​to be submitted?

+2


a source to share


1 answer


For ASP.Net MVC, you need to use the ValidateInput (false) attribute on your controller action like so:

    [ValidateInput(false)]
    public ActionResult SaveBodyCopy(int? id, string richTextEditor1)

      



Then the rest of your controller action.

+7


a source







All Articles