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.Net.WebRequest

Provides an HTTP-specific implementation of the class.

This class implements properties and methods defined in and provides additional properties and methods that enable the user to interact directly with servers using the Hypertext Transfer Protocol (HTTP).

Instances of this class are automatically created by the class. For example, an instance of is created when the method is called and a Uniform Resource Identifier (URI) beginning with http:// is specified. It is expected that an instance of this class will be constructed for every request made to the server. For example, after a call to cancels an asynchronous operation, a call to causes a to be thrown.

Requests can be sent synchronously or asynchronously. The method sends a request to a server synchronously and returns a instance containing the response. An asynchronous request for a resource is sent using the and methods.

Request data is sent using a request stream. The , , and methods return a instance used to send data.

When errors occur while accessing an Internet resource, the class throws a , and the property that indicates the source of the error. When is , the property contains the received from the Internet resource.

Certain HTTP headers are protected; the user cannot set them directly in the header collection obtained from the property. Instead, these headers are set using the associated properties of a instance, or are set by the system. The following table describes how each protected header is set.

Header
Set by
Accept
Connection

Content-Length
Content-Type
Expect
Date
Set to current date by the system.
Host
Set to current host by the system.
if-Modified-since
Range
Referer
Transfer-Encoding

User-Agent
- Constructor
  To be added.
  To be added.
  To be added.
  To be added.
  1.0.5000.0
  2.0.0.0
  System.Obsolete("Serialization is obsoleted for this type", false)
- Method
  System.Void

  Cancels an asynchronous operation.

  cancels any pending asynchronous operation. After this method is called, calling , , , , , or will throw a with set to .

  If no pending request exists, calling this method does not cause an exception to be thrown.

  This method overrides .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.String

  Gets or sets a containing the value of the HTTP Accept header.

  A containing the value of the HTTP Accept header. The default value of this property is .

  For additional information see section 14.1 of IETF RFC 2616 - HTTP/1.1.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Void `` A that specifies the starting or ending point of the range. If this value is positive, the range is from the beginning of the data to . If this value is negative, the range is from to the end of the data.

  Adds a HTTP Range header to the current instance for a specific range from the beginning or end of the requested data.

  This method is equivalent to ("bytes", ).

  The HTTP Range header specifies either a single range of bytes or a set of byte ranges in an entity-body to be returned. If the server accessed by the current instance supports the use of this header, this allows for the partial retrieval of the entity due to, for example, the entity being particularly large or there having been a failed transfer of data.

  For more information on the HTTP Range header, see Section 14.35 of RFC 2616.

  The range header could not be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Void `` `` A indicating the starting byte position of the entity-body data to be returned. A indicating the last byte.

  Adds a HTTP Range header to the current instance for a specified range.

  This method is equivalent to ("bytes", , ).

  The HTTP Range header specifies either a single range of bytes or a set of byte ranges in an entity-body to be returned. If the server accessed by the current instance supports the use of this header, this allows for the partial retrieval of the entity due to, for example, the entity being particularly large or there having been a failed transfer of data.

  For more information on the HTTP Range header, see Section 14.35 of RFC 2616.

  < 0.

  -or-

  < 0.

  -or-

  > .

  The range header could not be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Void `` `` A that contains the description of the range. A that designates the starting or ending point of the range. If this value is positive, the range is from the beginning of the data to . If this value is negative, the range is from to the end of the data.

  Adds a HTTP Range header to the current request for a specific range from the beginning or end of the requested data.

  The HTTP Range header specifies either a single range of bytes or a set of byte ranges in an entity-body to be returned. If the server accessed by the current instance supports the use of this header, this allows for the partial retrieval of the entity due to, for example, the entity being particularly large or there having been a failed transfer of data.

  For more information on the HTTP Range header, see Section 14.35 of RFC 2616.

  is . is invalid. The range header could not be added. 0 1.0.5000.0 2.0.0.0
- Method
  System.Void `` `` `` A that contains the description of the range. A designating the position at which to start sending data. A designating the position at which to stop sending data.

  Adds a HTTP Range header to the current instance for a specified range.

  The HTTP Range header specifies either a single range of bytes or a set of byte ranges in an entity-body to be returned. If the server accessed by the current instance supports the use of this header, this allows for the partial retrieval of the entity due to, for example, the entity being particularly large or there having been a failed transfer of data.

  For more information on the HTTP Range header, see Section 14.35 of IETF RFC 2616.

  is .

  < 0.

  -or-

  < 0.

  -or-

  > .

  is invalid. The range header could not be added. 0 1.0.5000.0 2.0.0.0
- Property
  System.Uri

  Gets the URI that responds to the current request.

  A identifying the Internet resource that responds to the current request. The default is the URI used by the method to initialize the current instance.

  This property is read-only.

  The value of this property is set to the URI that is the source of the response after all redirections are complete.

  The URI of the original request is kept in the property.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets or sets a value that indicates whether the current request will follow redirection responses.

  if the current request will automatically follow redirection responses from the Internet resource; otherwise . The default value is .

  Set to to allow the current request to automatically follow HTTP redirection headers to the new location of a resource.

  The maximum number of redirections to follow is set by the property.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets or sets a value that indicates whether to buffer the data sent to the Internet resource requested by the current instance.

  to enable buffering of the data sent to the Internet resource requested by the current instance; to disable buffering. The default is .

  When is , the data is buffered in memory so it is ready to be resent in the event of redirections or authentication requests.

  Depending on available memory, setting as might impact system performance when uploading large amounts of data.

  0
  1.0.5000.0
  2.0.0.0
- Property
  2.0.0.0
  System.Net.DecompressionMethods 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. Can be .

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

  A that contains information about the asynchronous operation.

  This method starts an asynchronous operation. To get the request stream, call the method and specify the object returned by this method. The method should be called exactly once for each call to .

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

  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.

  The value of the property of the current instance is required to be set prior to calling this method.

  The method(s) invoked by the callback delegate can call the method to retrieve the stream.

  This method is the asynchronous version of the method.

  This method overrides .

  The stream is being used by a previous call to .

  -or-

  No writeable stream is available.

  The property of the current instance is not set.

  -or-

  The property of the current instance is "GET" or "HEAD".

  was previously called.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.IAsyncResult `` `` A delegate to be called when the stream is available. Can be . A containing state information for the asynchronous request. Can be .

  Begins sending the current HTTP request asynchronously.

  A that contains information about the asynchronous operation.

  This method starts an asynchronous operation. To get the response, call the method and specify the object returned by this method. The method should be called exactly once for each call to .

  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 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.

  The method(s) invoked by the callback delegate can call the method to retrieve the response.

  This method is the asynchronous version of the method.

  This method overrides .

  or was previously called on this instance. The property of the current instance has not been set. was previously called. 0 1.0.5000.0 2.0.0.0
- Property
  System.Security.Cryptography.X509Certificates.X509CertificateCollection To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Property
  System.String

  Gets or sets the value of the Connection HTTP header.

  A containing the value of the Connection HTTP header. The default value is .

  The current request sends the property to the Internet resource as the Connection HTTP header.

  If is , the value "Keep-alive" is appended to the end of the Connection header.

  For additional information see section 14.10 of IETF RFC 2616 - HTTP/1.1.

  The value of is set to "Keep-alive" or "Close". This value is case insensitive. 0 1.0.5000.0 2.0.0.0
- 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. The default value is .

  The property enables a request to be associated with a connection group. This is useful when an application makes requests to one server for different users, such as a Web site that retrieves customer information from a database server.

  Each connection group creates additional connections for a server. This might result in exceeding for that server.

  This property overrides .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Int64

  Gets or sets the Content-length HTTP header.

  A value that specifies the number of bytes of data to send to the Internet resource. The default is -1, which indicates that this value has not been set.

  The property contains the value to send as the Content-length HTTP header of the request.

  Any value other than -1 in the property indicates that the request will upload data; only methods that upload data are allowed in the property.

  This property is required to be set prior to writing data to the request data stream. Once the property is set to a value, that number of bytes is required to be written to the request data stream. Get the request data stream by calling , or and .

  For additional information see section 14.13 of IETF RFC 2616 - HTTP/1.1.

  This property overrides .

  Data has already been written to the request stream. A value less than zero is specified for a set operation. 0 1.0.5000.0 2.0.0.0
- Property
  System.String

  Gets or sets the value of the Content-type HTTP header of the current instance.

  The value of the Content-type HTTP header of the current instance. The default value is .

  The property contains the media type of the current instance. Values assigned to the property replace any existing contents when the request sends the Content-type HTTP header.

  To clear the Content-type HTTP header, set the property to .

  For additional information see section 14.17 of IETF RFC 2616 - HTTP/1.1.

  This property overrides .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Net.HttpContinueDelegate

  Gets or sets the delegate method whose methods are invoked when an HTTP 100-continue response is received by the current instance.

  A that references the methods that are invoked when an HTTP Continue response is received. The default value is .

  This delegate is useful to display the status of responses received by the current instance.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Net.CookieContainer To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Property
  System.Net.ICredentials

  Gets or sets the credentials used for authenticating the current request.

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

  The property contains authentication information to identify the client making the request. The property can be either an instance of , in which case the user, password, and domain information contained in the instance is used to authenticate the request, or it can be an instance of , in which case the uniform resource identifier (URI) of the request is used to determine the user, password, and domain information to use to authenticate the request.

  This property overrides .

  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.Int32 To be added. To be added. To be added.
- Property
  1.0.5000.0
  2.0.0.0
  System.Int32 To be added. To be added. To be added.
- Method
  System.IO.Stream `` The object that holds the state information for the asynchronous operation.

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

  A to write request data to.

  The caller is responsible for calling the method to close the stream.

  This method overrides .

  is . was not returned by the current instance from a call to .

  This method was called previously using

  -or-

  No stream is available.

  was previously called.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Net.WebResponse `` The object that hold the state information for the asynchronous operation.

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

  A that contains a response to the Internet request referenced by .

  This method completes an asynchronous request for an Internet resource that was started by calling .

  This method overrides .

  is . was not returned by the current instance from a call to .

  This method was called previously using

  -or-

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

  was previously called.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.String

  Gets or sets the value of the HTTP Expect header.

  A that contains the contents of the HTTP Expect header. The default value is .

  By default, is . Other values can be added to the list that maintains, or all values except "100-continue" can be deleted from the list by setting to .

  For additional information see section 14.20 of IETF RFC 2616 - HTTP/1.1.

  The value specified for a set operation is "100-continue". This value is case insensitive. 0 1.0.5000.0 2.0.0.0
- Method
  System.Int32

  Generates a hash code for the current instance.

  A containing the hash code for the current instance.

  The algorithm used to generate the hash code is unspecified.

  This method overrides .

  0
  1.0.5000.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 the Internet resource requested by the current instance.

  A for writing data to an Internet resource requested by the current instance.

  The value of the property is required to be set before writing data to the stream.

  This method returns a stream to use to send data for the . Once the instance has been returned, data can be sent with the by using the method.

  Call the method to close the stream and release the connection for reuse. Failure to close the stream might cause the application to run out of connections.

  This method overrides .

  The property of the current instance is "GET" or "HEAD".

  -or-

  The property of the current instance is not set.

  The method was called more than once.

  -or-

  No writeable stream is available.

  was previously called.

  -or-

  The timeout period for the request expired.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Method
  System.Net.WebResponse

  Returns a response to an Internet request.

  A containing the response from the Internet resource requested by the current instance.

  This method returns a instance containing the response from the Internet resource requested by the current instance. The actual instance returned is an instance of , and can be typecast to that class to access HTTP-specific properties.

  This method overrides .

  The property of the current instance is not set.

  was previously called.

  -or-

  The timeout period for the request expired.

  -or-

  An error occurred while processing the request.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets a value indicating whether a response has been received for the current instance.

  if a response has been received; otherwise .

  This property is read-only.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Net.WebHeaderCollection

  Gets or sets the collection of HTTP header name/value pairs associated with the current instance.

  A containing the name/value pairs of the headers for the current instance.

  The following table lists the HTTP headers that cannot be set using the collection returned by this property.

  Header
  Set by
  Accept
  .
  Connection

  .

  .

  Content-Length
  .
  Content-Type
  .
  Expect
  .
  Date
  Set by the system to the current date.
  Host
  Set by the system to the current host information.
  Range
  .
  Referer
  .
  Transfer-Encoding

  .

  .

  User-Agent
  .

  This property overrides .

  A set operation was requested but data has already been written to the request data stream. 0 1.0.5000.0 2.0.0.0
- Property
  System.DateTime

  Gets or sets the value of the HTTP If-Modified-Since header.

  A that contains the contents of the HTTP If-Modified-Since header. The default value is the current date and time of the system.

  For additional information see section 14.25 of IETF RFC 2616 - HTTP/1.1.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets or sets a value indicating whether to make a persistent connection to the server hosting the Internet resource requested by the current instance.

  indicates that the current request will contain an HTTP Connection header with the value "Keep-alive" ; otherwise, . The default value is .

  An application uses to indicate a preference for persistent connections. When this property is , the application makes persistent connections to the servers that support them.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Int32

  Gets or sets the maximum number of redirects that the current instance will follow.

  A value that indicates the maximum number of redirection responses that the current instance will follow. The default value is implementation-specific.

  This property sets the maximum number of redirections for the request to follow if the property is .

  The value specified for a set operation is less than or equal to zero. 0 1.0.5000.0 2.0.0.0
- Property
  1.0.5000.0
  2.0.0.0
  System.Int32 To be added. To be added. To be added.
- Property
  System.String

  Gets or sets the media type of the current request.

  A that identifies the media type of the current request. The default value is .

  The value of this property affects the property. When this property is set in the current instance, the corresponding media type is chosen from the list of character sets returned in the response HTTP Content-type header.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.String

  Gets or sets the HTTP protocol request method used by the current instance.

  A containing an HTTP method. The default value is "GET".

  If the property is set to any value other than -1, the property is required to be set to a protocol method that sends request data.

  The property can be set to any of the following HTTP 1.1 protocol methods:

  HTTP Method
  Description
  GET
  Retrieves in entity-body form the information identified by the property of the current instance.
  HEAD
  Identical to GET except that the message-body is not returned in the response.
  POST
  Requests that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified the Request-URI in the Request-Line.
  PUT
  Requests that the enclosed entity be stored under the supplied Request-URI.
  DELETE
  Requests that the origin server delete the resource identified by the Request-URI.
  TRACE
  Invokes a remote, application-layer loopback of the request message.
  OPTIONS
  Requests information about the communication options available on the request/response chain identified by the Request-URI. This allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval.

  For detailed information regarding these methods, see sections 9.2 to 9.8 of RFC 2616.

  This property overrides .

  , , or an invalid value was specified for a set operation. 0 1.0.5000.0 2.0.0.0
- Property
  System.Boolean

  Gets or sets a value indicating whether to pipeline the current request to the Internet resource.

  if the current request can be pipelined; otherwise, . The default is .

  An application uses this property to indicate a preference for pipelined connections. If is , an application makes pipelined connections to servers that support them.

  Pipelined connections are made only when the property is .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets or sets a Boolean value that indicates whether to send HTTP preauthentication header information with current instance without waiting for an authentication challenge from the requested resource.

  to send a HTTP WWW-authenticate header with the current instance without waiting for an authentication challenge from the requested resource; otherwise, . The default is .

  When is and credentials are supplied, the HTTP WWW-authenticate header is sent with the current instance without waiting for an authentication challenge from the requested resource; otherwise the request uses standard authentication procedures.

  Set this property to to allow clients to improve server efficiency by avoiding extra round trips caused by authentication challenges.

  This property overrides .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Version

  Gets or sets the version of the HTTP protocol to use for the current request.

  A that represents the HTTP version to use for the request. The default is .

  The class supports only versions 1.0 and 1.1 of HTTP. Setting to a different version causes a exception to be thrown.

  To set the property of the current instance, specify one of the members of the use the class.

  The HTTP version is set to a value other than 1.0 or 1.1. 0 1.0.5000.0 2.0.0.0
- Property
  System.Net.IWebProxy

  Gets or sets network proxy information for the current instance.

  The instance to use as a proxy for the current instance. The default value is set by calling .

  The property identifies the instance to use to communicate with the destination server.

  To specify that no proxy should be used, set the property to the proxy instance returned by the method.

  This property overrides .

  A set operation was requested and the specified value was . A set operation was requested but data has already been sent to the request stream. The caller does not have permission for the requested operation. Requires unrestricted . See . 0 1.0.5000.0 2.0.0.0
- Property
  1.0.5000.0
  2.0.0.0
  System.Int32 To be added. To be added. To be added.
- Property
  System.String

  Gets or sets the value of the HTTP Referer header.

  A containing the value of the HTTP Referer header. The default value is .

  For additional information see section 14.36 of IETF RFC 2616 - HTTP/1.1.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Uri

  Gets the of the resource that receives requests sent by the current instance.

  The of the resource that receives requests sent by the current instance.

  This property is read-only.

  This property is the instance passed to the current instance via the method.

  Following a redirection header does not change the property. The URI of the resource that actually responded to the current instance is contained by property of the current instance.

  This property overrides .

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.Boolean

  Gets or sets a value indicating whether to send data in segments.

  to send data in segments; otherwise, . The default value is .

  When is , the request sends data to the destination in segments. The destination server is required to support receiving chunked data.

  Set this property to only if the server specified by the property of the current instance accepts chunked data (i.e. is HTTP/1.1 or greater in compliance). If the server does not accept chunked data, buffer all data to be written and send a HTTP Content-Length header with the buffered data.

  A set operation was requested but data has already been written to the request data stream. 0 1.0.5000.0 2.0.0.0
- Property
  System.Net.ServicePoint

  Gets the service point to use for the current instance.

  A that represents the network connection to the destination. The value of this property can be, but is not required to be, until the method is called.

  This property is read-only.

  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 the request times out.

  A indicating the number of milliseconds to wait for a response until the request times out, or to indicate that the request does not time out.

  is the number of milliseconds that a synchronous request made with the method waits for a response. If a resource does not respond within the time-out period, the request throws a with the property set to .

  This property overrides .

  A value less than zero and not equal to is specified for a set operation.

  0
  1.0.5000.0
  2.0.0.0
- Property
  System.String

  Gets or sets the value of the HTTP Transfer-encoding header.

  A that contains the value of the HTTP Transfer-encoding header. The default value is .

  This property can be set in the current instance only if the property in the current instance is .

  Clearing by setting it to has no effect on the value of .

  Values assigned to the property replace any existing contents.

  For additional information see section 14.41 of IETF RFC 2616 - HTTP/1.1.

  is set when is . is set to the value "Chunked". This value is case insensitive. 0 1.0.5000.0 2.0.0.0
- Property
  System.Boolean To be added. To be added. To be added. 1.0.5000.0 2.0.0.0
- Property
  2.0.0.0
  System.Boolean To be added. To be added. To be added.
- Property
  System.String

  Gets or sets the value of the HTTP User-agent header.

  A containing the value of the HTTP User-agent header. The default value is .

  For additional information see section 14.43 of IETF RFC 2616 - HTTP/1.1.

  0
  1.0.5000.0
  2.0.0.0
0