System.Net Namespace

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

The System.Net namespace provides a simple programming interface for many of the protocols used on networks today. The WebRequest and WebResponse classes form the basis of what are called pluggable protocols, an implementation of network services that enables you to develop applications that use Internet resources without worrying about the specific details of the individual protocols.

Capabilities

If you use this API in your app, you must specify the following capabilities in the app manifest. Otherwise, your app might not work correctly or it might exit unexpectedly.

ID_CAP_NETWORKING

Windows Phone 8, Windows Phone OS 7.1

For more info, see App capabilities and hardware requirements for Windows Phone 8.

Classes

Class Description
Cookie Provides an object for use with HTTP requests to persist state information for a Windows Phone-based application.
CookieCollection Represents a collection of Cookie objects.
CookieContainer Provides a container for a collection of CookieCollection objects.
CookieException The exception that is thrown when adding a Cookie to a CookieCollection.
CredentialCache Provides storage for multiple credentials.
DnsEndPoint Represents a network endpoint as a host name or a string representation of an IP address and a port number.
DownloadProgressChangedEventArgs Provides data for the DownloadProgressChanged event of a WebClient.
DownloadStringCompletedEventArgs Provides data for the DownloadStringCompleted event.
EndPoint Identifies a network address. This is an abstract class.
HttpUtility Provides methods for encoding and decoding HTML and URL strings.
HttpWebRequest Provides an HTTP-specific implementation of the WebRequest class.
HttpWebResponse Provides an HTTP-specific implementation of the WebResponse class.
IPAddress Provides an Internet Protocol (IP) address.
IPEndPoint Represents a network endpoint as an IP address and a port number.
NetworkCredential Provides credentials for password-based authentication schemes such as basic, digest, NTLM, and Kerberos authentication.
OpenReadCompletedEventArgs Provides data for the OpenReadCompleted event.
OpenWriteCompletedEventArgs Provides data for the OpenWriteCompleted event.
ProtocolViolationException The exception that is thrown when an error is made while using a network protocol.
SocketAddress Stores serialized information from EndPoint derived classes.
UploadProgressChangedEventArgs Provides data for the UploadProgressChanged event of a WebClient.
UploadStringCompletedEventArgs Provides data for the UploadStringCompleted event.
WebClient Provides common methods for sending data to and receiving data from a resource identified by a URI.
WebException The exception that is thrown when an error occurs while accessing the network through a pluggable protocol.
WebHeaderCollection Contains protocol headers associated with a request or response.
WebRequest Makes a request to a Uniform Resource Identifier (URI). This is an abstract class.
WebResponse Provides a response from a Uniform Resource Identifier (URI). This is an abstract class.
WebUtility Provides methods for encoding and decoding URLs when processing Web requests.
WriteStreamClosedEventArgs Provides data for the WriteStreamClosed event.

Interfaces

Interface Description
ICredentials Provides the base authentication interface for retrieving credentials for Web client authentication.
ICredentialsByHost Provides the interface for retrieving credentials for a host, port, and authentication type.
IWebRequestCreate Provides the base interface for creating WebRequest instances.

Delegates

Delegate Description
DownloadProgressChangedEventHandler Represents the method that will handle the WebClient..::.DownloadProgressChanged event of a WebClient.
DownloadStringCompletedEventHandler Represents the method that will handle the DownloadStringCompleted event of a WebClient.
OpenReadCompletedEventHandler Represents the method that will handle the OpenReadAsync event of a WebClient.
OpenWriteCompletedEventHandler Represents the method that will handle the OpenWriteCompleted event of a WebClient.
UploadProgressChangedEventHandler Represents the method that will handle the UploadProgressChanged event of a WebClient.
UploadStringCompletedEventHandler Represents the method that will handle the UploadStringCompleted event of a WebClient.
WriteStreamClosedEventHandler Represents the method that will handle the WriteStreamClosed event of a WebClient.

Enumerations

Enumeration Description
AuthenticationSchemes Specifies protocols for authentication.
HttpRequestHeader The HTTP headers that may be specified in a client request.
HttpStatusCode Contains the values of status codes defined for HTTP.
WebExceptionStatus Defines status codes for the WebException class.