다음을 통해 공유


HttpUtility Class

Provides access to methods used to encode and decode strings during the processing of Web requests.

Inheritance Hierarchy

System.Object
  Microsoft.SharePoint.Client.Utilities.HttpUtility

Namespace:  Microsoft.SharePoint.Client.Utilities
Assembly:  Microsoft.SharePoint.Client (in Microsoft.SharePoint.Client.dll)

Syntax

'Declaration
Public Class HttpUtility
'Usage
Dim instance As HttpUtility
public class HttpUtility

Examples

This code example encodes the URL of the All Tasks View of the specified site.

using System;
using Microsoft.SharePoint.Client;

namespace Microsoft.SDK.SharePointFoundation.Samples
{
    class HttpUtilityExample
    {
        static void Main()
        {

            string siteUrl = "http://MyServer/sites/MySiteCollection";

            ClientContext clientContext = new ClientContext(siteUrl);
            Web site = clientContext.Web;

            List targetList = site.Lists.GetByTitle("Tasks");
            View targetView = targetList.Views.GetByTitle("All Tasks");

            clientContext.Load(targetView);
            clientContext.ExecuteQuery();

            String relativeUrl = targetView.ServerRelativeUrl;
            String encodedUrl = Microsoft.SharePoint.Client.Utilities.HttpUtility.EcmaScriptStringLiteralEncode(relativeUrl);
            Console.WriteLine("Encoded All Tasks View URL: {0}", encodedUrl);
        }

    }
}

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

HttpUtility Members

Microsoft.SharePoint.Client.Utilities Namespace