Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebRequestCreator.ClientHttp Property

Silverlight

Gets an object that specifies client HTTP handling for Web requests and responses.

Namespace:  System.Net.Browser
Assembly:  System.Windows (in System.Windows.dll)

public static IWebRequestCreate ClientHttp { get; }

Property Value

Type: System.Net.IWebRequestCreate
An IWebRequestCreate object for use with Silverlight-based application that runs outside of a Web browser. 

With Silverlight, you can specify whether the browser or the client provides HTTP handling for your Silverlight-based applications. By default, HTTP handling is performed by the browser and you must opt-in to client HTTP handling.

The following is a list of scenarios that you would typically specify client HTTP handling for:

  • Using HTTP methods other than GET and POST.

  • Using response status codes, bodies and headers.

  • Sending HTTP XML requests such as messages to SOAP and REST services.

  • Manually managing cookies.

The following example shows you how to specify client HTTP handling for all messages.


bool httpResult = WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
bool httpsResult = WebRequest.RegisterPrefix("https://", WebRequestCreator.ClientHttp);


...


if (httpResult == true)
{
    WebClient wc = new WebClient();
    wc.OpenReadAsync(new Uri("http://api.search.live.net/qson.aspx?query=Silverlight"));
    wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

Show:
© 2016 Microsoft