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