In this case, the server security settings prevent the client from sending HTML-containing data to the server. Previously, in Asp.net webform, The validaterequest attribute is set to false in the page command, or directly on the web. configure in the config file,
Now we use the Asp.net MVC framework to develop Web applications.ProgramOf course, it can also be configured in the web. config file, but in this case, the entire web application is basically restricted, sometimes only want to limit a part of the function. There are also two ways to do this in Asp.net MVC. First, add the [validateinput (false)] feature on the action to obtain client information. In addition, the current ASP. net mvc controller has an attribute validaterequest. Set this attribute to false to obtain the client value.
Method 1:
[Validateinput (false)]
Public actionresult demoview ()
{
//.........
Return view ();
}
In the second method, I directly set validaterequest to false in the Controller constructor. In fact, it can be set anywhere before obtaining data.
Public controllerdemocontroller ()
{
This. validaterequest = false;
}
Website development _ website production _ website maintenance _ online shop production _ online shop installation _ mall production _ mobile phone software _ enterprise website _ office software _ QQ: 471226865
Point more healthy