在网页中显示html代码

时间:2014-08-10 15:28:10   收藏:0   阅读:236
string str = "<div>aaa</div>";
            this.Literal1.Text = string.Format("<pre>{0}</pre>", str.Replace("<", "&lt;").Replace(">", "&gt;"));

 

string str = "<div>中国</div>";
            this.Literal1.Text = Server.HtmlEncode(str);

 

在网页中显示html代码,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!