Asp.net mvc TinyMCE文本编辑器;在post上显示所有html标记,包括<;html>&书信电报;车身>&;诸如此类
型号: 控制器:Asp.net mvc TinyMCE文本编辑器;在post上显示所有html标记,包括<;html>&书信电报;车身>&;诸如此类,asp.net-mvc,asp.net-mvc-4,tinymce-4,Asp.net Mvc,Asp.net Mvc 4,Tinymce 4,型号: 控制器: public class MyEditor { [Required(ErrorMessage = "Required!")] [AllowHtml] [UIHint("tinymce_classic")] public string PageContents { get; set; } } 视图: public ActionResult TinyE
public class MyEditor
{
[Required(ErrorMessage = "Required!")]
[AllowHtml]
[UIHint("tinymce_classic")]
public string PageContents { get; set; }
}
视图:
public ActionResult TinyEditor(MyEditor OBJ)
{
var obj = OBJ.PageContents;
if (ModelState.IsValid)
{
}
return View(OBJ);
}
@使用(Html.BeginForm())
{
@EditorFor(m=>m.PageContents)
@Html.ValidationMessageFor(m=>m.PageContents)
提交
}
问题:在Post上,模型会得到如下所示的所有html标记。为什么会这样
获取html页面的所有标记
:
你好
@using (Html.BeginForm())
{
<div class="editor-label">
@Html.EditorFor(m => m.PageContents)
@Html.ValidationMessageFor(m => m.PageContents)
<button type="submit">SUBMIT</button>
</div>
}
<!DOCTYPE html>
<html> <head> </head> <body> <p>Hello</p> <p><img
src="http://www.my.org/content/img/4.jpg" alt="" width="50"
height="50" /></p> </body> </html>