共用方式為


SPHttpUtility.UrlPathEncode Method (String, 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, _
    output As TextWriter _
)
'Usage
Dim urlToEncode As String
Dim allowHashParameter As Boolean
Dim output As TextWriterSPHttpUtility.UrlPathEncode(urlToEncode, _
    allowHashParameter, output)
public static void UrlPathEncode(
    string urlToEncode,
    bool allowHashParameter,
    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.

  • 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 calls the UrlPathEncode(String, Boolean, Boolean, TextWriter) method with the urlToEncode, allowHashParameter, false, and output.

See Also

Reference

SPHttpUtility Class

SPHttpUtility Members

UrlPathEncode Overload

Microsoft.SharePoint.Utilities Namespace