System.Net.HttpWebRequest.Date Property

Get or set the Date HTTP header value to use in an HTTP request.

Syntax

public DateTime Date { get; set; }

Value

Documentation for this section has not yet been entered.

Remarks

If the Date header is null, then the return value will be set to DateTime.MinValue.

The HttpWebRequest.Date property is a standard DateTime object and can contain a DateTimeKind field of DateTimeKind.Local, DateTimeKind.Utc, or DateTimeKind.Unspecified. Any kind of time can be set when using the HttpWebRequest.Date property. If DateTimeKind.Unspecified is set or retrieved, the HttpWebRequest.Date property is assumed to be DateTimeKind.Local (local time).

The classes in the System.Net namespace always write it out the HttpWebRequest.Date property on the wire during transmission in standard form using GMT (Utc) format.

If the HttpWebRequest.Date property is set to DateTime.MinValue, then the Date HTTP header is removed from the HttpWebRequest.Headers property and the System.Net.WebHeaderCollection.

If the HttpWebRequest.Date property is DateTime.MinValue, this indicates that the Date HTTP header is not included in the HttpWebRequest.Headers property and the System.Net.WebHeaderCollection.

Note:

The value for this property is stored in System.Net.WebHeaderCollection. If WebHeaderCollection is set, the property value is lost.

If the HttpWebRequest.Date is set and an attempt is made to send a System.Net.HttpWebRequest with no body, then a System.Net.ProtocolViolationException will be thrown by the HttpWebRequest.BeginGetResponse(AsyncCallback, object), HttpWebRequest.GetResponse, and HttpWebRequest.EndGetResponse(IAsyncResult) methods.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 4.0.0.0