UrlHelper.Encode Method

Encodes special characters in a URL string into character-entity equivalents.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

'Declaration
Public Function Encode ( _
	url As String _
) As String
'Usage
Dim instance As UrlHelper 
Dim url As String 
Dim returnValue As String 

returnValue = instance.Encode(url)

Parameters

url
Type: System.String

The text to encode.

Return Value

Type: System.String
An encoded URL string.

If characters such as spaces and punctuation are passed in an HTTP stream, they can be misinterpreted when they are processed. URL encoding converts special characters in a URL into character-entity equivalents. For example, when the characters < and > are embedded in a block of text to be transmitted in a URL, they are encoded as %3c and %3e.

Show: