ExpiresHeaderValue Class
Definition
- Namespace
- Cuemon.AspNetCore.Http.Headers
- Assemblies
- Cuemon.AspNetCore.dll
Represents a HTTP Expires header that contains the date/time after which the response is considered stale.
public class ExpiresHeaderValue
- Inheritance
-
ExpiresHeaderValue
Examples
The following example demonstrates how to use to specify when a response should be considered stale.
using System;
using Cuemon.AspNetCore.Http.Headers;
namespace MyApp.Examples;
public class ExpiresHeaderValueExample
{
public void Demonstrate()
{
// Create an Expires header value that makes the response stale after 1 hour
var expires = new ExpiresHeaderValue(TimeSpan.FromHours(1));
// The ToString() method produces the RFC 1123 format
string headerValue = expires.ToString();
Console.WriteLine($"Expires: {headerValue}");
// Output example: "Expires: Thu, 17 Jun 2026 12:00:00 GMT"
}
}
Constructors
| Name | Description |
|---|---|
| ExpiresHeaderValue(TimeSpan) | Initializes a new instance of the ExpiresHeaderValue class. |
Methods
| Name | Description |
|---|---|
| ToString() | Returns a string that represents this instance. |