Windows Dev Center

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.

HttpDateOrDeltaHeaderValue class

Represents the value of the Retry-After HTTP header on an HTTP response.

Syntax


var httpDateOrDeltaHeaderValue = Windows.Web.Http.Headers.HttpDateOrDeltaHeaderValue;

Members

The HttpDateOrDeltaHeaderValue class has these types of members:

Methods

The HttpDateOrDeltaHeaderValue class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
Parse Converts a string to an HttpDateOrDeltaHeaderValue instance.
ToString Returns a string that represents the current HttpDateOrDeltaHeaderValue object.
TryParse Determines whether a string is valid HttpDateOrDeltaHeaderValue information.

 

Properties

The HttpDateOrDeltaHeaderValue class has these properties.

PropertyAccess typeDescription

Date

Read-onlyGets the value of the HTTP-date information used in the Retry-After HTTP header.

Delta

Read-onlyGets the value of the delta-seconds information used in the Retry-After HTTP header.

 

Remarks

The HttpDateOrDeltaHeaderValue class represents the Retry-After HTTP header on an HTTP response.

The RetryAfter property on the HttpResponseHeaderCollection returns an HttpDateOrDeltaHeaderValue object.

Examples

The following sample code shows a method to get and set the Retry-After HTTP header on an HttpResponseMessage object using the properties and methods on the HttpDateOrDeltaHeaderValue class.



using System;
using Windows.Web.Http;
using Windows.Web.Http.Headers;

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

            // Set the header with a strong type.
            HttpDateOrDeltaHeaderValue newvalue;
            bool parseOk = HttpDateOrDeltaHeaderValue.TryParse("", out newvalue);
            if (parseOk) {
                response.Headers.RetryAfter = newvalue;
            }

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

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


Requirements (Windows 10 device family)

Device family

Universal

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 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps, desktop apps]

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

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06030000)]

See also

HttpResponseHeaderCollection
HttpResponseMessage
IStringable
Object
RetryAfter

 

 

Show:
© 2015 Microsoft