Networking System [00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ] 1.0.x.x 1.0.5000.0 2.0.0.0 All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe. System.MarshalByRefObject System.Runtime.Serialization.ISerializable

Makes a request to a Uniform Resource Identifier (URI).

is an abstract class that models the request side of transactions used for accessing data from the Internet.

Classes that derive from are required to override the following members of the class in a protocol-specific manner:

-- Gets or sets the protocol method to use in the current instance.
-- Gets the of the resource associated with the current instance.
-- Gets or sets the collection of header name/value pairs associated with the request.
-- Gets or sets the content length of the request data being sent.
-- Gets or sets the content type of the request data being sent.
-- Gets or sets the credentials used for authenticating the client using the current instance.
-- Gets or sets a value that indicates whether to send authentication information with a request for resources.
-- Returns a for writing data to a resource.
-- Begins an asynchronous request for a stream in which to write data to be sent in the current request.
-- Returns a for writing data to the resource accessed by the current instance.
-- Returns a response to a request.
-- Begins an asynchronous request for a resource.
-- Returns a that contains a response to a specified pending request.

In addition, derived classes are required to support the interface.

An application that uses the request/response model can request data be sent from the Internet in a protocol-agnostic manner, in which the application works with instances of the class while classes that derive from and

implement specific protocols perform the details of the request.

Requests are sent from an application to a particular Uniform Resource Identifier (URI), such as a Web page on a server. Using the URI, the method creates an instance of a type derived from to handle the request. The type is selected from the set of registered types. Types may be registered to handle a specific protocol, such as HTTP or FTP, or to handle a request to a specific server or path on a server. For information on registering types, see .

The class throws a exception when an error occurs while accessing a resource.

Use the method to initialize a new instance of a class that derives from . Do not use the constructor.

If the environment variable http_proxy is set, this specifies the proxy to be used for HTTP requests; The format of this string is the url of the proxy server.

The following example demonstrates using to create an instance of .

`using System; using System.Net; public class WebRequestExample { public static void Main() { // Initialize the WebRequest. WebRequest myRequest = WebRequest.Create("http://www.contoso.com"); // Print the type of the request. Console.WriteLine(myRequest); } }`

The output is

System.Net.HttpWebRequest

- Constructor

  Constructs a new instance of the class.

  This constructor is called only by classes that derive from .

  Use the method to initialize a new instance of a class that derives from . Do not use this constructor.

  0
  1.0.5000.0
  2.0.0.0
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
- Method
  System.Void

  Attempts to cancel an asynchronous request made by the current instance to access a resource.

  As described above.

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  Use this method to cancel an asynchronous operation started with the method.

  This method is not overridden in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Net.Security.AuthenticationLevel To be added. To be added. To be added.
- Method
  System.IAsyncResult `` `` A delegate to be called when the stream is available. Can be . A containing state information for the asynchronous request.

  Begins an asynchronous request for a stream in which to write data to be sent in the current request.

  A object that contains information about the asynchronous operation.

  The parameter can be any object that the caller wishes to have available for the duration of the asynchronous operation. This object is available via the property of the object returned by this method.

  This method starts an asynchronous operation to obtain a stream used to write data to be sent in the current request. To get the request stream, call the method and specify the object returned by this method.

  If the parameter is not , the method referenced by is invoked when the asynchronous operation completes. The object returned by this method is passed as the argument to the method referenced by .

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  Use this method to start an asynchronous request for a stream used to send data to a resource. The delegate can call the method to obtain the request stream.

  This method is not overridden in the derived class. 0 1.0.5000.0 2.0.0.0
- Method
  System.IAsyncResult `` `` A delegate to be called when the response from the server is available. A containing state information for the asynchronous request.

  Begins sending the current request asynchronously.

  A object that contains information about the asynchronous operation.

  The parameter can be any object that the caller wishes to have available for the duration of the asynchronous operation. This object is available via the property of the object returned by this method.

  This method starts an asynchronous operation to send the current request and receive the response from the server that processed the request. To get the response, call the method and specify the object returned by this method.

  If the parameter is not , the method referenced by is invoked when the asynchronous operation completes. The object returned by this method is passed as the argument to the method referenced by .

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  The method starts an asynchronous request for a response. The callback delegate can call the method to return the received from the resource. This method is not overridden in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Net.Cache.RequestCachePolicy To be added. To be added. To be added.
- Property
  System.String

  Gets or sets the name of the connection group for the current instance.

  A that contains the name of the connection group for the current instance.

  This property associates specific requests within an application with a .

  As described above.

  This property throws .

  This property is required to be overridden by classes that inherit from . The property typically associates a group of requests that share a set of credentials with a connection to an Internet resource to avoid potential security failures.

  Use this property to get or set the name of the connection group for the current instance.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  System.Int64

  Gets or sets the content length of the request data being sent.

  A containing the number of bytes of request data being sent.

  This property is required to throw a exception if data has already been written to the request stream, and a exception if the property is being set to a value less than zero.

  This property throws .

  This property is required to be overridden by classes that inherit from .

  Use this property to get the number of bytes sent to the resource.

  This property is not implemented in the derived class. Data has already been written to the request stream. This property is being set to a value less than zero. 0 1.0.5000.0 2.0.0.0
- Property
  System.String

  Gets or sets the content type of the request data being sent.

  A that represents the content type of the request data.

  The property contains the media type of the request.

  This is typically the MIME encoding of the content.

  As described above.

  This property throws .

  This property is required to be overridden by classes that inherit from .

  Use this property to get the media type of request.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Method
  System.Net.WebRequest `` A that contains a URI.

  Constructs a new instance of a class derived from . The new instance is of the type registered for the scheme of the specified URI.

  A new instance of a class that derived from and is registered to handle the scheme of .

  This method returns a new instance of a class that derived from . The of this new instance is determined at run time by the scheme of the URI in . For example, when a URI beginning with http:// is passed in , a instance is returned.

  Classes that derive from that are created to handle other requests are registered with the method.

  is . The request scheme specified in is not registered. The URI specified in is not a valid URI. The caller does not have permission to connect to the requested URI or a URI that the request is redirected to. Requires permission to connect to the requested URI. See . 0 1.0.5000.0 2.0.0.0
- Method
  System.Net.WebRequest `` A containing the URI of the requested resource. Constructs a new instance of a class derived from .

  A new instance of a class derived from that is registered to handle the closest registered match for .

  To determine the closest match, this method checks the registered URIs for the longest URI prefix that matches .

  For an example that demonstrates this method, see .

  is . The request scheme specified in is not registered. The caller does not have permission to connect to the requested URI or a URI that the request is redirected to. Requires permission to connect to the requested URI. See . 0 1.0.5000.0 2.0.0.0
- Method
  System.Net.WebRequest `` A containing the URI of the requested resource.

  Constructs a new instance of a class derived from . The new instance is of the type registered for the scheme of the specified URI.

  A new instance of the type derived from that is registered for the scheme of the specified .

  When this method is invoked, only the scheme portion of is checked against the list of URIs registered for the current instance. Conversely, when is invoked, the entire URI is checked against the list of registered URIs.

  is . The request scheme specified in is not registered. The caller does not have permission to connect to the requested URI or a URI that the request is redirected to. Requires permission to connect to the requested URI. See .

  This example demonstrates the use of the and methods.

  `using System; using System.Net; public class ContosoTextRequest : WebRequest, IWebRequestCreate { public new WebRequest Create(Uri uri) { return new ContosoTextRequest(); } } public class CreateDefaultExample { public static void Main() { ContosoTextRequest contoso = new ContosoTextRequest(); Uri contosoUri = new Uri("http://www.contoso.com/text"); WebRequest.RegisterPrefix("http://www.contoso.com/text", contoso); WebRequest httpContoso = WebRequest.CreateDefault(contosoUri); Console.WriteLine("CreateDefault --> {0}", httpContoso); WebRequest textContoso = WebRequest.Create(contosoUri); Console.WriteLine("Create --> {0}", textContoso); } }`

  The output is

  CreateDefault --> System.Net.HttpWebRequest

  Create --> ContosoTextRequest

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Net.ICredentials

  Gets or sets the credentials used for authenticating the client using the current instance.

  A object containing the authentication credentials associated with the request. The default is .

  As described above.

  This property throws .

  This property is required to be overridden by classes that inherit from .

  Use this property to store or access the user, password, and domain information of the current instance.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Net.Cache.RequestCachePolicy To be added. To be added. To be added.
- Property
  2.0.0.0
  System.Net.IWebProxy To be added. To be added. To be added.
- Method
  System.IO.Stream `` A object that references a request for a started with .

  Returns a for writing data to the resource identified by the property of the current instance.

  A to write data to.

  This method completes an asynchronous request for a stream that was started by the method.

  As described above.

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  Use this method to complete an asynchronous request for a stream that was started with the method.

  This method is not overridden in the derived class. was not returned by a call to . is a null reference.

  This method was called previously using

  -or-

  No stream is available.

  An error occurred while processing the request. 0 1.0.5000.0 2.0.0.0
- Method
  System.Net.WebResponse `` A object that references a pending request that was started with .

  Returns a that contains a response to a specified pending request.

  A that contains a response to the request referenced by .

  As described above.

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  Use this method to complete an asynchronous request for an Internet resource that was started with the method.

  This method is not overridden in the derived class. was not returned by a call to . is a null reference.

  The property of the current instance is greater than zero but no data has been written to the request stream.

  -or-

  This method was called previously using

  An error occurred while processing the request. 0 1.0.5000.0 2.0.0.0
- Method
  2.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Method
  System.IO.Stream

  Returns a for writing data to a resource.

  A for writing data to a resource.

  As described above.

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method is required to be overridden by classes that inherit from .

  Use this method to initiate a request to send data to a resource and obtain a instance for sending data to that resource.

  The method provides synchronous access to the . For asynchronous access, use the and methods.

  This method is not overridden in the derived class. 0 1.0.5000.0 2.0.0.0
- Method
  System.Net.WebResponse

  Returns a response to a request.

  A containing the response to the request.

  This method returns an instance of a type derived from that is registered for the property of the current instance. This new instance is required to contain a response from the resource to the current request.

  If the timeout period for the request expires, or an error occurs while processing the request, this method is required to throw a exception.

  The class is abstract and does not provide an implementation for this method. This method throws .

  This method must be overridden by classes that inherit from to provide this functionality.

  Use this method for synchronous access to a resource. For asynchronous access, use the and methods.

  This method is not overridden in the derived class.

  The request timed out.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Method
  2.0.0.0
  System.Net.IWebProxy To be added. To be added. To be added.
- Property
  System.Net.WebHeaderCollection

  Gets or sets the collection of header name/value pairs associated with the request.

  A containing the header name/value pairs associated with the current instance.

  This property contains a instance containing the header information to send to resources.

  As described above.

  This property throws a exception.

  This property must be overridden by classes that inherit from .

  Use this property to determine the header information of a request.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Security.Principal.TokenImpersonationLevel To be added. To be added. To be added.
- Property
  System.String

  Gets or sets the protocol method to use in the current instance.

  A containing the protocol method to use in the current instance.

  The default value of this property is required to be a protocol method that does not require protocol-specific properties to be set. For the HTTP protocol, this value is GET.

  This property throws .

  This property must be overridden by classes that inherit from to provide this functionality.

  Use this property to set the protocol-specific method that will be used to make a request.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  System.Boolean

  Gets or sets a value that determines whether to send authentication information with the current request instead of waiting for an authentication challenge from the requested resource.

  if authentication information will be sent with the current request without waiting for an authentication challenge from the requested resource; otherwise, .

  If is , the current instance sends authentication credentials without waiting to be challenged by the server specified by the property of the current instance. When this property is , the current instance waits for a challenge from the server before sending credentials.

  This property throws .

  This property must be overridden by classes that inherit from to provide this functionality.

  Use this property to ensure that authentication information is sent with every request. Setting this property to allows clients to improve server efficiency by avoiding extra round trips caused by authentication challenges.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  System.Net.IWebProxy

  Gets or sets the network proxy to use to access resources.

  A to use to access resources.

  The property identifies the network proxy that the request uses to access resources. The request is made through the proxy server rather than directly to the server hosting the resource.

  If the property of the current instance has not been set, the value of this property is required to be .

  If the property is being set to , it is required to throw a exception.

  This property throws .

  This property must be overridden by classes that inherit from to provide this functionality.

  Use this method to obtain a instance that represents the proxy server used by the current instance.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Method
  System.Boolean `` `` A containing the URI that the derived type services. Can specify a scheme or a complete URI. An instance of a type that implements the interface.

  Registers a type derived from , and associates the type with the specified URI.

  if registration is successful; , if is already registered.

  is registered to service requests for HTTP and HTTPS schemes. Attempts to register a different type for these schemes will fail.

  This method registers types that derive from to service requests. These derived types are typically registered to handle a specific protocol, such HTTP or FTP, but can be registered to handle a request to a specific server or path on a server. Therefore, can be either a scheme or a complete URI.

  The class calls the method to create additional instances of the same type as .

  is or is .

  The following example demonstrates how to register a new scheme.

  `using System; using System.Net; public class ftpWebRequest : WebRequest { //implement ftp-specific protocol methods and properties } public class ftpCreator : IWebRequestCreate { public WebRequest Create(Uri uri) { return new ftpWebRequest(); } } public class RegisterPrefixExample { public static void Main() { ftpCreator creator = new ftpCreator(); WebRequest.RegisterPrefix("ftp://", creator); WebRequest wr = WebRequest.Create("ftp://testFile"); Console.WriteLine(wr); } }`

  The output is

  ftpWebRequest

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Uri

  Gets the of the resource associated with the current instance.

  A containing the URI of the resource associated with the current instance

  This property is read-only.

  is required to contain the URI passed to the methods. If the protocol implemented by a derived class supports redirection, the derived class is required to provide a property to contain the URI that actually services the request.

  This property throws a exception.

  This property must be overridden by classes that inherit from to provide this functionality. ]

  Use this property to determine the URI that the request was addressed to. For information about the URI that actually serviced the request, see .

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Method
  1.0.5000.0
  2.0.0.0
  System.Void `` `` To be added. To be added. To be added. To be added.
- Property
  System.Int32

  Gets or sets the length of time before requests for resources time out.

  A containing the length of time, in milliseconds, before the current request will time out, or to indicate that the request does not time out.

  Classes that derive from are required to indicate a timeout by throwing a with the field set to if a request times out.

  This property throws a exception.

  This property must be overridden by classes that inherit from to provide this functionality.

  Use this property to set the timeout period for requests for resources.

  The property affects only synchronous requests made with the method. To time out asynchronous requests, use the method.

  This property is not implemented in the derived class. 0 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Boolean To be added. To be added. To be added.
0