Windows desktop applications
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

HttpRequestHeaderCollection.IfModifiedSince | ifModifiedSince property

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

Syntax


var ifModifiedSince = httpRequestHeaderCollection.ifModifiedSince;
httpRequestHeaderCollection.ifModifiedSince = ifModifiedSince;

Property value

Type: IReference<DateTime> [JavaScript/C++] | System.Nullable<DateTime> [.NET]

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

Remarks

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

Javascript and .NET languages do not use the DateTime object directly. In Javascript a DateTime is projected as a Date 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 DateTime.UniversalTime value has the same granularity as a FILETIME 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-Modified-Since header on an HttpRequestMessage object using the IfModifiedSince property on the HttpRequestHeaderCollection object.


    public void DemonstrateHeaderRequestIfModifiedSince() {
        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.IfModifiedSince = value;

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

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


Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.winmd

See also

DateTime
HttpRequestHeaderCollection
HttpRequestMessage
HttpRequestMessage.Headers
IfUnmodifiedSince

 

 

Show:
© 2016 Microsoft