asp.net mvc3 cshtml 编码问题
Controllers:
public ActionResult Index()
{
ViewData["html"] = Server.HtmlEncode("<div>aa</div>");
return View();
}
view:
@Server.HtmlDecode(ViewData["html"].ToString())
显示为乱码,不加编码也是,就是<这种格式,求解,如何让其正常
------解决方案--------------------
直接输出Html吗?
C# code
//razor:
@Html.Raw(ViewData["html"] as string)