Export (0) Print
Expand All
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 Class

July 28, 2014

Provides objects for specifying that the Windows Phone client handles HTTP requests and responses. Since the Windows Phone client provides HTTP handling by default, you typically never need to use this class.

System.Object
  System.Net.Browser.WebRequestCreator

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

public static class WebRequestCreator

The WebRequestCreator type exposes the following members.

  NameDescription
Public propertyStatic memberClientHttpGets an object that specifies client HTTP handling for Web requests and responses.
Top

You pass the properties of this class to the RegisterPrefix method of WebRequest .

You can specify the scope for HTTP handling. For example, you can specify HTTP handling for all messages, for a particular domain, or for a single request object.

After you specify HTTP handling for a particular scheme or domain, you cannot change how HTTP messages to the domain or scheme are handled. If you try to call RegisterPrefix a second time for the same domain or prefix, the method will return false to indicate the register operation was not successful.

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=Windows"));
    wc.OpenReadCompleted += new OpenReadCompletedEventHandler(wc_OpenReadCompleted);
}


Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

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

Show:
© 2014 Microsoft