NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

HTTP

In most cases, WebRequest and WebResponse will be the ideal classes for sending and retrieving data from Internet resources using HTTP. However, the System.Net namespace includes an HTTP protocol-specific implementation of the WebRequest and WebResponse classes for use when needed. These classes encapsulate a standard HTTP request and response transaction, and provide access to common HTTP headers through properties. Custom headers and headers not provided through properties can be accessed by storing them in the Headers property.

HttpWebRequest is the default class used by WebRequestFactory and does not need to be registered before passing an HTTP Uniform Resource Identifier (URI) to the WebRequestFactory.Create method.

You application can automatically follow HTTP redirects by setting the AllowAutoRedirect property true. When the request is redirected, the ResponseURI property of the HttpWebResponse will contain the actual Web resource that responded to the request. When AllowAutoRedirect is false, your application must be prepared to handle redirects as an HTTP protocol error.

HTTP protocol errors are returned by throwing a WebException with the Status set to WebStatus.ProtocolError. The Response property contains the WebResponse sent by the server and it can be examined to find the actual HTTP error encountered.