Jaa


HttpRequestHeaderCollection.IfUnmodifiedSince Property

Definition

Gets or sets the DateTime object that represents the value of an If-Unmodified-Since HTTP header on an HTTP request.

public:
 property IReference<DateTime> ^ IfUnmodifiedSince { IReference<DateTime> ^ get(); void set(IReference<DateTime> ^ value); };
IReference<DateTime> IfUnmodifiedSince();

void IfUnmodifiedSince(IReference<DateTime> value);
public System.Nullable<System.DateTimeOffset> IfUnmodifiedSince { get; set; }
var iReference = httpRequestHeaderCollection.ifUnmodifiedSince;
httpRequestHeaderCollection.ifUnmodifiedSince = iReference;
Public Property IfUnmodifiedSince As Nullable(Of DateTimeOffset)

Property Value

The DateTime object that represents the value of an If-Unmodified-Since HTTP header on an HTTP request. A null value means that the header is absent.

Remarks

The IfUnmodifiedSince property represents the value of an If-Unmodified-Since HTTP header on an HTTP request message. The If-Unmodified-Since header is the date and time the content was not modified since.

Javascript and .NET languages do not use the DateTime object directly. In Javascript a DateTime is projected as a object, and in .NET it is projected as a System.DateTimeOffset. Each language transparently handles the conversion to the granularity and date ranges for the respective language.

In C++, a value has the same granularity as a and supports the date ranges required by Javascript and .NET.

For more detailed information, see the Windows.Foundation.DateTime structure.

The following sample code shows a method to set the If-Unmodified-Since header on an HttpRequestMessage object using the IfUnmodifiedSince property on the HttpRequestHeaderCollection object.

public void DemonstrateHeaderRequestIfUnmodifiedSince() {
    var request = new HttpRequestMessage();

    // This is not typically set with a string.

    // Set the header with a strong type.
    var value = DateTimeOffset.Now.AddDays(-1); // Since yesterday.
    request.Headers.IfUnmodifiedSince = value;

    // Get the strong type out
    System.Diagnostics.Debug.WriteLine("IfUnmodifiedSince value in ticks: {0}", request.Headers.IfUnmodifiedSince.Value.Ticks);

    // The ToString() is useful for diagnostics, too.
    System.Diagnostics.Debug.WriteLine("The IfUnmodfiedSince ToString() results: {0}", request.Headers.IfUnmodifiedSince.ToString());
}

Applies to

See also