首先,在提交形式字符串时,要在Control中使用[ValidateInput(false)]来实现
[ValidateInput(false)]
[HttpPost]
public ActionResult CompanyIntroduction(string Introduction)
{
}
对于其他Asp.Net可以使用
web.config
<system.web>
<httpRuntime requestValidationMode="2.0" />
</system.web>
其次在Razor视图中接收的时候,要使用Html的Raw方法对html字符串进行编码
@Html.Raw((string)@ViewBag.Introduction)