本文整理汇总了VB.NET中System.Web.HttpServerUtility.UrlEncode方法的典型用法代码示例。如果您正苦于以下问题:VB.NET HttpServerUtility.UrlEncode方法的具体用法?VB.NET HttpServerUtility.UrlEncode怎么用?VB.NET HttpServerUtility.UrlEncode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了HttpServerUtility.UrlEncode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1:
Public Class _Default
Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim destinationURL = "http://www.contoso.com/default.aspx?user=test"
NextPage.NavigateUrl = "~/Finish?url=" + Server.UrlEncode(destinationURL)
End Sub
End Class
示例2: SampleClass
Public Class SampleClass
Public Function GetUrl() As String
Dim destinationURL = "http://www.contoso.com/default.aspx?user=test"
Return "~/Finish?url=" + HttpContext.Current.Server.UrlEncode(destinationURL)
End Function
End Class
示例3:
Dim TestString As String = "This is a <Test String>."
Dim writer As New StringWriter
Server.UrlEncode(TestString, writer)
Dim EncodedString As String = writer.ToString()