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.

HttpResponseHeaderCollection.Age | age property

Applies to Windows and Windows Phone

Gets or sets the TimeSpan object that represents the value of an Age HTTP header on an HTTP response.


var age = httpResponseHeaderCollection.age;
httpResponseHeaderCollection.age = age;

Property value

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

The object that represents the value of an Age HTTP header on an HTTP response. A null value means that the header is absent.


The Age property represents the value of he Age header on an HTTP response. The Age header is the age of the entity in the cache.

When building Windows Store apps with the Microsoft .NET Framework, this structure is hidden and developers should use the System.TimeSpan structure.

In JavaScript, this structure is accessed as a value, not as an object. For example, use var a = 10000, not var a = { duration: 10000 }.

Note   In JavaScript, this structure is treated as the number of millisecond intervals, not the number of 100-nanosecond intervals. Therefore, Windows.Foundation.TimeSpan values can lose precision when being ported between languages.

For more detailed information, see the Windows.Foundation.TimeSpan interface.

The following sample code shows a method to set the Age header on an HttpResponseMessage object using the Age property on the HttpResponseHeaderCollection object.

    public void DemonstrateHeaderResponseAge() {
        var response = new HttpResponseMessage();

        // Set the header with a strong type.
        DateTimeOffset value = DateTimeOffset.UtcNow;
        response.Headers.Age = new TimeSpan(1, 35, 55); // 1 hour, 35 minutes, 55 seconds.

        // Get the strong type out
        System.Diagnostics.Debug.WriteLine("Age value in minutes: {0}", response.Headers.Age.Value.TotalMinutes);

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


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]


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



See also




© 2014 Microsoft