MVC使用方法

1.mvc打开html代码

后台处理:

  ///<summary>
        ///恢复html中的特殊字符
        ///</summary>
        ///<paramname="theString">需要恢复的文本。</param>
        ///<returns>恢复好的文本。</returns>
        public static string HtmlDiscode(string theString)
        {
            theString=theString.Replace("&gt;",">");
            theString=theString.Replace("&lt;","<");
            theString=theString.Replace("&nbsp;"," ");
            theString=theString.Replace("&quot;","\"");
            theString = theString.Replace("&#39;", "\'");
            theString=theString.Replace("<br/>","\n");
            return theString;
        }
View Code

前台页面:

@Html.Raw(ViewBag.content)
View Code

猜你喜欢

转载自www.cnblogs.com/chenze-Index/p/10980732.html