[HttpPost]
[ValidateInput (False)]
Public ActionResult AddNews1 (_54young_news_model.model.gou54contentall contentmodel, _54young_news_ Model.model.gou54user Usermodel)
{}
Found with some special symbols can not be submitted, and then thought that the front-end problem, the model is removed on it. It is thought that there is a special symbol that affects the turn model.
Wrote a request to the model, but still an error.
<summary>
The content of the requested request is converted to model
Cza
2016-5-30 19:06:21
</summary>
<param name= "Context" ></param>
<returns></returns>
public static T Converttomodel ()
{
HttpContext context=system.web.httpcontext.current;
T t = new t ();
propertyinfo[] Propertys = T.gettype (). GetProperties ();
foreach (PropertyInfo pi in Propertys)
{
if (!pi. CanWrite)
Continue
Try
{
Object value = Context. Request[pi. Name];
if (value! = NULL && value! = DBNull.Value)
{
if (value. ToString ()! = "")
Pi. SetValue (t, Convert.changetype (value, pi). PropertyType), null);//This step is important for type conversion
Else
Pi. SetValue (t, value, NULL);
}
}
Catch
{ }
}
return t;
}
On-line data see can be added in Web. config, but it is too dangerous to be global.
<system.web>
<pages validaterequest= "false"/>
</system.web>
And then you see that. You can add this validation method in front of the method
[HttpPost]
[ValidateInput (False)]
Public ActionResult AddNews1 (_54young_news_model.model.gou54contentall contentmodel, _54young_news_ Model.model.gou54user Usermodel)
{
}
ASP. NET MVC submission model cannot receive