共用方式為


SPHttpUtility.UrlPathEncode Method (String, Boolean, Boolean, TextWriter)

Encodes the specified path part of a URL for HTTP transmission, and appends it to the specified output stream.

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

Syntax

'Declaration
Public Shared Sub UrlPathEncode ( _
    urlToEncode As String, _
    allowHashParameter As Boolean, _
    encodeUnicodeCharacters As Boolean, _
    output As TextWriter _
)
'Usage
Dim urlToEncode As String
Dim allowHashParameter As Boolean
Dim encodeUnicodeCharacters As Boolean
Dim output As TextWriterSPHttpUtility.UrlPathEncode(urlToEncode, _
    allowHashParameter, encodeUnicodeCharacters, _
    output)
public static void UrlPathEncode(
    string urlToEncode,
    bool allowHashParameter,
    bool encodeUnicodeCharacters,
    TextWriter output
)

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.

  • encodeUnicodeCharacters
    Type: System.Boolean

    true to encode Unicode characters; otherwise, false.

  • output
    Type: System.IO.TextWriter

    A T:System.IO.TextWriter object that represents the output stream to which to add the encoded path.

Remarks

This method encodes the following characters in the urlToEncode parameter up to the first '?' character: control characters (0-31),' ','"','%','<','>','\'','&', and characters greater than 0x7F.

If allowHashParameter is true, this method stops at the first '#' character.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

UrlPathEncode Overload

Microsoft.SharePoint.Utilities Namespace