在使用 百度编辑器 Ueditor 时,不能进入 Controller 相应的 Action 的处理方法

如果在前端的页面中使用了 Ueditor 编辑器,那么在提交表单数据时,将不会执行 期望的 Controller 中的 Action ,造成这样的原因是: 在 MVC 4 的框架中,当前端页面需要提交表单到 Controller 的 Action 中时, MVC 4 的框架出于安全机制的考虑,会对表单进行危险字符串验证过滤,因为 Ueditor 会产生一些额外的 html 标签和 js, 这样一来,自然就不会进入 Controller 的 Action 中了,在用 FireFox 浏览器时进行发送包跟踪时,会发现 404 和 500 的响应码,如下所示

解决办法: 将 Controller 的 Action 设置成 不进行验证,也就是加个特性 [ValidateInput(false)] 即可

原文地址:https://www.cnblogs.com/wisdo/p/4443468.html