.net里 lable 编码有关问题 简单

.net里 lable 编码问题 简单页面上有个lable 控件后台给lable 赋值this.Label.Text img srchttp://w

.net里 lable 编码问题 简单
页面上有个lable 控件


后台给lable 赋值this.Label.Text = "<img src='http://www.baidu.com/img/baidu_logo.gif'/>";

运行时页面上出现图标,

哟没办法让页面上出现<img src='http://www.baidu.com/img/baidu_logo.gif'/> ????

[解决办法]
这个不行吧
要这样
this.Label.Text = " &gt;img src='http://www.baidu.com/img/baidu_logo.gif'/&lt;"; 

[解决办法]
This.Label.Text = Server.HtmlEncode (" <img src='http://www.baidu.com/img/baidu_logo.gif'/>"); 

刚测试通过
[解决办法]

探讨
这个不行吧
要这样
this.Label.Text = " &gt;img src='http://www.baidu.com/img/baidu_logo.gif'/&lt;";

[解决办法]

C# code
This.Label.Text = Server.HtmlEncode (" <img src='http://www.baidu.com/img/baidu_logo.gif'/>"); string str=" <img src='http://www.baidu.com/img/baidu_logo.gif'/> ";str=Server.HtmlEncode(str);Response.Write(str);//这就是个 Server.HtmlEncode 的使用