![](/img/trans.png)
[英]how can I use Crystal reports in VB.NET 2013 ( Visual Studio 2013)
[英]How can I use the HtmlEncode (or HtmlDecode) function in Visual Studio (vb.net)?
我正在制作一個涉及登錄服務器的應用程序,但是,后期數據需要一些編碼。
Dim strEncUsername As String = Server.HtmlEncode(Me.txtUsername.Text)
但是,由於這不是一個asp.net應用程序,這不起作用。 干草我應該怎么做? 我試圖找一個Imports的東西,但沒有真正的運氣。
如果向項目添加對System.Web的引用,則可以使用以下內容對字符串進行html編碼
Dim strEncUsername As String = System.Web.HttpUtility.HtmlEncode(Me.txtUsername.Text)
編輯
顯示HtmlEncode的intellisense的屏幕截圖:
項目中引用的屏幕截圖:
申請表輸出:
unsafe text: <em>evil em tags within</em>
safe text: <em>evil em tags within</em>
在.NET 4.0客戶端配置文件中沒有System.web ...我想知道為什么。
它甚至不能作為參考添加。
但同樣的事情可以通過使用:
System.Net.WebUtility.HtmlDecode
你應該使用HttpUtility
(首先添加對System.Web的引用)。
在Windows應用程序中,您還可以使用:
System.Net.WebUtility.HtmlEncode
提供框架版本為4或以上,請參閱:[link] https://msdn.microsoft.com/en-us/library/ee388364(v=vs.110).aspx
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.