This is a subclass of WebRequest. .NET uses this
subclass to request documents from
the http and https URI schemes
(RFCs 2616 and 2818, respectively). An instance of this type is
returned by WebRequest.Create( ) when a URI
starting with the http:// or
https:// prefix is passed in. Since that
method's return value is
WebRequest, cast it to
HttpWebRequest if you need access to any of the
methods or properties that are unique to this class (and the HTTP or
HTTPS protocol).
The properties on this type correspond directly to the headers
documented in the RFC standard documentation; see that document for
details regarding their contents. Note that because these headers are
sent as part of the HTTP request, any modification of the headers
must be done before the request is sent to the remote host. (Calling
either GetResponse( ) or
BeginGetResponse( ), the asynchronous version of
GetResponse( ), sends the request.)
When a WebRequest encounters an error, a
WebException is thrown.
public class HttpWebRequest : WebRequest {
// Protected Constructors
protected HttpWebRequest(System.Runtime.Serialization.SerializationInfo serializationInfo,
System.Runtime.Serialization.StreamingContext streamingContext);
// Public Static Properties
public static int DefaultMaximumResponseHeadersLength{set; get; }
// Public Instance Properties
public string Accept{set; get; }
public Uri Address{get; }
public bool AllowAutoRedirect{set; get; }
public bool AllowWriteStreamBuffering{set; get; }
public X509CertificateCollection ClientCertificates{get; }
public string Connection{set; get; }
public override string ConnectionGroupName{set; get; }
//overrides WebRequest
public override long ContentLength{set; get; }
// overrides WebRequest
public override string ContentType{set; get; }
// overrides WebRequest
public HttpContinueDelegate ContinueDelegate{set; get; }
public CookieContainer CookieContainer{set; get; }
public override ICredentials Credentials{set; get; }
// overrides WebRequest
public string Expect{set; get; }
public bool HaveResponse{get; }
public override WebHeaderCollection Headers{set; get; }
// overrides WebRequest
public DateTime IfModifiedSince{set; get; }
public bool KeepAlive{set; get; }
public int MaximumAutomaticRedirections{set; get; }
public int MaximumResponseHeadersLength{set; get; }
public string MediaType{set; get; }
public override string Method{set; get; }
// overrides WebRequest
public bool Pipelined{set; get; }
public override bool PreAuthenticate{set; get; }
// overrides WebRequest
public Version ProtocolVersion{set; get; }
public override IWebProxy Proxy{set; get; }
// overrides WebRequest
public int ReadWriteTimeout{set; get; }
public string Referer{set; get; }
public override Uri RequestUri{get; }
// overrides WebRequest
public bool SendChunked{set; get; }
public ServicePoint ServicePoint{get; }
public override int Timeout{set; get; }
// overrides WebRequest
public string TransferEncoding{set; get; }
public bool UnsafeAuthenticatedConnectionSharing{set; get; }
public string UserAgent{set; get; }
// Public Instance Methods
public override void Abort( );
// overrides WebRequest
public void AddRange(int range);
public void AddRange(int from, int to);
public void AddRange(string rangeSpecifier, int range);
public void AddRange(string rangeSpecifier, int from, int to);
public override IAsyncResult BeginGetRequestStream(AsyncCallback callback, object state)
// overrides WebRequest
public override IAsyncResult BeginGetResponse(AsyncCallback callback, object state)
// overrides WebRequest
public override Stream EndGetRequestStream(IAsyncResult asyncResult)
// overrides WebRequest
public override WebResponse EndGetResponse(IAsyncResult asyncResult)
// overrides WebRequest
public override int GetHashCode( );
// overrides object
public override Stream GetRequestStream( );
// overrides WebRequest
public override WebResponse GetResponse( );
// overrides WebRequest
}