1.mvc打开html代码
后台处理:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
///<summary> ///恢复html中的特殊字符 ///</summary> ///<paramname="theString">需要恢复的文本。</param> ///<returns>恢复好的文本。</returns> public static string HtmlDiscode(string theString) { theString=theString.Replace(">",">"); theString=theString.Replace("<","<"); theString=theString.Replace(" "," "); theString=theString.Replace(""","\""); theString = theString.Replace("'", "\'"); theString=theString.Replace("<br/>","\n"); return theString; }
前台页面:
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
@Html.Raw(ViewBag.content)