共用方式為


SPHttpUtility.UrlPathEncode Method (String, Boolean)

Encodes the specified path part of a URL for HTTP transmission.

Namespace:  Microsoft.SharePoint.Utilities
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
Public Shared Function UrlPathEncode ( _
    urlToEncode As String, _
    allowHashParameter As Boolean _
) As String
'Usage
Dim urlToEncode As String
Dim allowHashParameter As Boolean
Dim returnValue As String

returnValue = SPHttpUtility.UrlPathEncode(urlToEncode, _
    allowHashParameter)
public static string UrlPathEncode(
    string urlToEncode,
    bool allowHashParameter
)

Parameters

  • urlToEncode
    Type: System.String

    A string that contains the path.

  • allowHashParameter
    Type: System.Boolean

    true to specify that the decode operation can include a hash parameter; otherwise, false.

Return Value

Type: System.String
A string that contains the encoded path.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

UrlPathEncode Overload

Microsoft.SharePoint.Utilities Namespace