当前位置:首页 > 网络编程 > WEB编程 > ASP.net > ASP.NET: HtmlEncode/UrlEncode

ASP.NET: HtmlEncode/UrlEncode

点击次数:23 次 发布日期:2008-11-26 23:29:04 作者:源代码网
源代码网推荐 Code:
源代码网推荐
源代码网推荐 <%@ Page Language="VB" %>
源代码网推荐 <%@ Import Namespace="System.Web.HttpUtility" %>
源代码网推荐 <html>
源代码网推荐 <head>
源代码网推荐 <title>HTMLEncode and URLEncode the ASP.NET Way</title>
源代码网推荐
源代码网推荐 <s cript language="VB" runat="server">
源代码网推荐 Sub Page_Load(sender As Object, e As EventArgs)
源代码网推荐
源代码网推荐     "Assign our test url to a variable, assign the variable to our label control
源代码网推荐     Dim strURLText as String = "urlencode.asp?test=1&test1=2"
源代码网推荐     strURL.Text = strURLText
源代码网推荐    
源代码网推荐     "Encode the test url, assign it to a variable, assign the variable to our label control
源代码网推荐     Dim strURLEncodeText As String = UrlEncode(strURLText)
源代码网推荐     strURLEncode.Text = strURLEncodeText
源代码网推荐    
源代码网推荐     "Assign our test url to a variable, assign the variable to our label control
源代码网推荐     Dim strHTMLText As String = "<h1>This is a test & hopefully it works!</h1>"
源代码网推荐     strHTML.Text = strHTMLText
源代码网推荐
源代码网推荐     "Encode the test html, assign it to a variable, assign the variable to our label control
源代码网推荐     Dim strHTMLEncodeText As String = HtmlEncode(strHTMLText)
源代码网推荐     strHTMLEncode.Text = strHTMLEncodeText
源代码网推荐
源代码网推荐 End Sub
源代码网推荐 </s cript>
源代码网推荐 </head>
源代码网推荐 <body>
源代码网推荐 <asp:label id="strURL" forecolor="red" font-bold="true" runat=server/>
源代码网推荐 <p>
源代码网推荐 <asp:label id="strURLEncode" forecolor="blue" font-bold="true" runat=server/>
源代码网推荐 <p>
源代码网推荐 <asp:label id="strHTML" forecolor="red" font-bold="true" runat=server/>
源代码网推荐 <p>
源代码网推荐 <asp:label id="strHTMLEncode" forecolor="blue" font-bold="true" runat=server/>
源代码网推荐 <br>
源代码网推荐 </body>
源代码网推荐 </html>
源代码网推荐
源代码网推荐
源代码网推荐 Result:
源代码网推荐 urlencode.asp?test=1&test1=2
源代码网推荐
源代码网推荐 urlencode.asp%3ftest%3d1%26test1%3d2
源代码网推荐
源代码网推荐
源代码网推荐 This is a test & hopefully it works!
源代码网推荐 <h1>This is a test & hopefully it works!</h1>
源代码网推荐        

源代码网供稿.
网友评论 (0)
会员中心
网络编程
本站推荐
网络编程之精华