亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

請問該如何使用Html.Encode()?

請問該如何使用Html.Encode()?

拉風的咖菲貓 2021-09-17 11:11:36
<p>地址:西安市</p><p>電話:<br /> 中的空格和換行用TextBox顯示出來其中的<br /> 顯示成換行和空格!
查看完整描述

2 回答

?
臨摹微笑

TA貢獻1982條經驗 獲得超2個贊

var str="<p>地址:西安市</p><p>電話:<br /> 中的空格和換行用TextBox顯示出來其中的<br />"
;
response.write(server.htmlEncode(str))

查看完整回答
反對 回復 2021-09-23
?
大話西游666

TA貢獻1817條經驗 獲得超14個贊

命名空間:System.Web.HttpContext.Current.Server.HtmlEncode(string);

使用Demo:


public void Page_Load(object sender, EventArgs e){   string strHtml = "<h1>是標題標記</h1>";   string strHtmlEncode = Server.HtmlEncode(strHtml); //編碼   string strHtmlDecode = Server.HtmlDecode(strHtmlEncode);//解碼   Response.Write(strHtml + "");   Response.Write(strHtmlEncode + "");    Response.Write(strHtmlDecode + "");}


查看完整回答
反對 回復 2021-09-23
  • 2 回答
  • 0 關注
  • 407 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號