HttpResponseHeaderCollection
HttpResponseHeaderCollection
HttpResponseHeaderCollection
HttpResponseHeaderCollection
Class
Definition
Provides a collection of the HTTP headers associated with an HTTP response.
public : sealed class HttpResponseHeaderCollection : IIterable, IMap, IStringable, IHttpResponseHeaderCollectionpublic sealed class HttpResponseHeaderCollection : IEnumerable, IDictionary, IStringable, IHttpResponseHeaderCollectionPublic NotInheritable Class HttpResponseHeaderCollection Implements IEnumerable, IDictionary, IStringable, IHttpResponseHeaderCollection// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Examples
The following sample code shows a method to get and set response headers on an HttpResponseMessage object using the properties on the HttpResponseHeaderCollection object. The Windows.Web.Http.Headers namespace has a number of strongly-typed header collection and value classes for specific HTTP headers that can be used to get and set headers with validation.
using System;
using System.Collections.Generic;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Web.Http;
using Windows.Web.Http.Headers;
void DemonstrateResponseHeaders() {
DemonstrateHeaderResponseAge();
DemonstrateHeaderResponseAllow();
DemonstrateHeaderResponseCacheControl();
DemonstrateHeaderResponseDate();
DemonstrateHeaderResponseLocation();
DemonstrateHeaderResponseProxyAuthenticate();
}
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());
}
public void DemonstrateHeaderResponseAllow()
{
var response = new HttpResponseMessage();
// Set the header with a string
response.Headers.Allow.TryParseAdd ("GET");
// Set the header with a strong type
response.Headers.Allow.Add(HttpMethod.Patch);
// Get the strong type out
foreach (var value in response.Headers.Allow)
{
System.Diagnostics.Debug.WriteLine("Allow value: {0}", value.Method);
}
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The Allow ToString() results: {0}", response.Headers.Allow.ToString());
}
public void DemonstrateHeaderResponseCacheControl()
{
var response = new HttpResponseMessage();
// Set the header with a string
response.Headers.CacheControl.TryParseAdd("public");
// Set the header with a strong type
response.Headers.CacheControl.Add(new HttpNameValueHeaderValue("max-age", "30"));
// Get the strong type out
foreach (var value in response.Headers.CacheControl)
{
System.Diagnostics.Debug.WriteLine("CacheControl {0}={1}", value.Name, value.Value);
}
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The CacheControl ToString() results: {0}", response.Headers.CacheControl.ToString());
}
public void DemonstrateHeaderResponseDate()
{
var response = new HttpResponseMessage();
// Set the header with a strong type.
response.Headers.Date = DateTimeOffset.UtcNow;
// 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());
}
public void DemonstrateHeaderResponseLocation()
{
var response = new HttpResponseMessage();
// Set the header with a strong type.
response.Headers.Location = new Uri("http://example.com/");
// Get the strong type out
System.Diagnostics.Debug.WriteLine("Location absolute uri: {0}", response.Headers.Location.AbsoluteUri);
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The Location ToString() results: {0}", response.Headers.Location.ToString());
}
public void DemonstrateHeaderResponseProxyAuthenticate()
{
var response = new HttpResponseMessage();
// Set the header with a strong type.
response.Headers.ProxyAuthenticate.TryParseAdd("Basic");
response.Headers.ProxyAuthenticate.Add(new HttpChallengeHeaderValue("authScheme", "authToken"));
// Get the strong type out
foreach (var value in response.Headers.ProxyAuthenticate)
{
System.Diagnostics.Debug.WriteLine("Proxy authenticate scheme and token: {0} {1}", value.Scheme, value.Token);
}
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The ProxyAuthenticate ToString() results: {0}", response.Headers.ProxyAuthenticate.ToString());
}
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());
}
Remarks
The HttpResponseHeaderCollection is a collection of the HTTP headers associated with an HTTP response to an HTTP request message. The HttpResponseHeaderCollection object can be used to get or set the specific headers on the HTTP response. Most of the properties on the HttpResponseHeaderCollection object provide access for the value of a specific HTTP header.
The Headers property on HttpResponseMessage returns an HttpResponseHeaderCollection object. This is how an HttpResponseHeaderCollection is constructed.
Enumerating the collection in C# or Microsoft Visual Basic
You can iterate through an HttpResponseHeaderCollection object in C# or Microsoft Visual Basic. In many cases, such as using foreach syntax, the compiler does this casting for you and you won't need to cast to IEnumerable explicitly. If you do need to cast explicitly, for example if you want to call GetEnumerator, cast the collection object to IEnumerable
Properties
Age Age Age Age
Gets or sets the TimeSpan object that represents the value of an Age HTTP header on an HTTP response.
public : IReference<TimeSpan> Age { get; set; }public Nullable<TimeSpan> Age { get; set; }Public ReadWrite Property Age As Nullable<TimeSpan>// You can use this property in JavaScript.
- Value
- IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>
The object that represents the value of an Age HTTP header on an HTTP response. A null value means that the header is absent.
Remarks
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 programming with .NET, this structure is hidden and developers should use the System.TimeSpan structure. The value can be null, because it's typed as TimeSpan? (a nullable TimeSpan).
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());
}
Allow Allow Allow Allow
Gets the HttpMethodHeaderValueCollection of HttpMethod objects that represent the value of an Allow HTTP header on an HTTP response.
public : HttpMethodHeaderValueCollection Allow { get; }public HttpMethodHeaderValueCollection Allow { get; }Public ReadOnly Property Allow As HttpMethodHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpMethodHeaderValueCollection HttpMethodHeaderValueCollection HttpMethodHeaderValueCollection HttpMethodHeaderValueCollection
The collection of HttpMethod objects that represent the value of an Allow HTTP header on an HTTP response. An empty collection means that the header is absent.
Remarks
The Allow property represents the value of an Allow HTTP header on an HTTP response. The Allow header is a list of HTTP methods (GET, PUT, and POST, for example) allowed by the HTTP server.
The following sample code shows a method to get and set the Allow header on an HttpResponseMessage object using the Allow property on the HttpResponseHeaderCollection object.
public void DemonstrateHeaderResponseAllow() {
var response = new HttpResponseMessage();
// Set the header with a string
response.Headers.Allow.TryParseAdd ("GET");
// Set the header with a strong type
response.Headers.Allow.Add(HttpMethod.Patch);
// Get the strong type out
foreach (var value in response.Headers.Allow) {
System.Diagnostics.Debug.WriteLine("Allow value: {0}", value.Method);
}
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The Allow ToString() results: {0}", response.Headers.Allow.ToString());
}
- See Also
CacheControl CacheControl CacheControl CacheControl
Gets the HttpCacheDirectiveHeaderValueCollection of objects that represent the value of a Cache-Control HTTP header on an HTTP response.
public : HttpCacheDirectiveHeaderValueCollection CacheControl { get; }public HttpCacheDirectiveHeaderValueCollection CacheControl { get; }Public ReadOnly Property CacheControl As HttpCacheDirectiveHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpCacheDirectiveHeaderValueCollection HttpCacheDirectiveHeaderValueCollection HttpCacheDirectiveHeaderValueCollection HttpCacheDirectiveHeaderValueCollection
The collection of objects that represent the value of a Cache-Control HTTP header on an HTTP response. An empty collection means that the header is absent.
Remarks
The CacheControl property represents the value of a Cache-Control HTTP header on an HTTP response.
Some of the objects in the HttpCacheDirectiveHeaderValueCollection for the Cache-Control header use the Windows.Foundation.TimeSpan structure. When programming with .NET, this structure is hidden and developers should use the System.TimeSpan structure. The value can be null, because it's typed as TimeSpan? (a nullable TimeSpan).
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.
For more detailed information, see the Windows.Foundation.TimeSpan interface.
- See Also
Connection Connection Connection Connection
Gets the HttpConnectionOptionHeaderValueCollection of HttpConnectionOptionHeaderValue objects that represent the value of a Connection HTTP header on an HTTP response.
public : HttpConnectionOptionHeaderValueCollection Connection { get; }public HttpConnectionOptionHeaderValueCollection Connection { get; }Public ReadOnly Property Connection As HttpConnectionOptionHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpConnectionOptionHeaderValueCollection HttpConnectionOptionHeaderValueCollection HttpConnectionOptionHeaderValueCollection HttpConnectionOptionHeaderValueCollection
The collection of HttpConnectionOptionHeaderValue objects that represent the value of a Connection HTTP header. An empty collection means that the header is absent.
Remarks
The following sample code shows a method to get and set the Connection header on an HttpResponseMessage object using the Connection property on the HttpResponseHeaderCollection object.
// Connection:keep-alive
// HttpConnectionOptionHeaderValueCollection, a collection of
// HttpConnectionOptionHeaderValue which just has a Token (string)
//
// This is the same type as on the request
void DemoConnection(HttpResponseMessage response) {
var h = response.Headers;
h.Connection.TryParseAdd("close");
h.Connection.TryParseAdd("some,values");
h.Connection.Add(new HttpConnectionOptionHeaderValue("last"));
var header = h.Connection;
uiLog.Text += "\nCONNECTION HEADER\n";
foreach (var item in header) {
uiLog.Text += String.Format("Token: {0} ToString: {1}\n", item.Token, item.ToString());
}
uiLog.Text += String.Format("Connection: {0}\n", header.ToString());
}
- See Also
Date Date Date Date
Gets or sets the DateTime object that represents the value of a Date HTTP header on an HTTP response.
public : IReference<DateTime> Date { get; set; }public Nullable<DateTimeOffset> Date { get; set; }Public ReadWrite Property Date As Nullable<DateTimeOffset>// You can use this property in JavaScript.
- Value
- IReference<DateTime> Nullable<DateTimeOffset> Nullable<DateTimeOffset> Nullable<DateTimeOffset>
The object that represents the value of a Date HTTP header on an HTTP request. A null value means that the header is absent.
Remarks
The Date property represents the value of a Date HTTP header on an HTTP response. The Date header is the date and time the message was sent.
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 get and set the Date header on an HttpResponseMessage object using the Date property on the HttpResponseHeaderCollection object.
public void DemonstrateHeaderResponseDate() {
var response = new HttpResponseMessage();
// Set the header with a strong type.
response.Headers.Date = DateTimeOffset.UtcNow;
// 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());
}
Item[TKey] Item[TKey] Item[TKey] Item[TKey]
Gets or sets the element with the specified key.
This member is not implemented in C++TValue this[TKey key] { get; set; }Property Item(key As TKey) As TValueTValue this[TKey key] { get; set; }
- key
- TKey TKey TKey TKey
The key of the element to get or set.
- Value
- TValue TValue TValue TValue
The element with the specified key.
key is null.
The property is retrieved and key is not found.
The property is set and the System.Collections.Generic.IDictionary`2 is read-only.
Keys Keys Keys Keys
Gets an System.Collections.Generic.ICollection`1 containing the keys of the System.Collections.Generic.IDictionary`2.
This member is not implemented in C++ICollection<TKey> Keys { get; }ReadOnly Property Keys As ICollection(Of TKey)ICollection<TKey> Keys { get; }
- Value
An System.Collections.Generic.ICollection`1 containing the keys of the object that implements System.Collections.Generic.IDictionary`2.
Location Location Location Location
Gets or sets the Uri that represents the value or a Location HTTP header on an HTTP response.
public : Uri Location { get; set; }public Uri Location { get; set; }Public ReadWrite Property Location As Uri// You can use this property in JavaScript.
- Value
- Uri Uri Uri Uri
The object that represents the value of a Location HTTP header on an HTTP response. A null value means that the header is absent.
Remarks
The following sample code shows a method to set the Location header on an HttpResponseMessage object using the Location property on the HttpResponseHeaderCollection object.
public void DemonstrateHeaderResponseLocation() {
var response = new HttpResponseMessage();
// Set the header with a strong type.
response.Headers.Location = new Uri("http://example.com/");
// Get the strong type out
System.Diagnostics.Debug.WriteLine("Location absolute uri: {0}", response.Headers.Location.AbsoluteUri);
// The ToString() is useful for diagnostics, too.
System.Diagnostics.Debug.WriteLine("The Location ToString() results: {0}", response.Headers.Location.ToString());
}
- See Also
-
ProxyAuthenticate ProxyAuthenticate ProxyAuthenticate ProxyAuthenticate
Gets the HttpChallengeHeaderValueCollection of HttpChallengeHeaderValue objects that represent the value of a Proxy-Authenticate HTTP header on an HTTP response.
public : HttpChallengeHeaderValueCollection ProxyAuthenticate { get; }public HttpChallengeHeaderValueCollection ProxyAuthenticate { get; }Public ReadOnly Property ProxyAuthenticate As HttpChallengeHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection
The collection of HttpChallengeHeaderValue objects that represent the value of a Proxy-Authenticate HTTP header on an HTTP response. An empty collection means that the header is absent.
Remarks
The following sample code shows a method to get and set the Proxy-Authenticate header on an HttpResponseMessage object using the ProxyAuthenticate property on the HttpResponseHeaderCollection object.
// Proxy-Authenticate: Basic
// HttpChallengeHeaderValueCollection
// HttpChallengeHeaderValue has Scheme and Token (both strings) + Parameters
// Parameters is an IList<HttpNameValueHeaderValue>
// HttpNameValueHeaderValue has Name and Value, both strings
void DemoProxyAuthenticate(HttpResponseMessage response) {
var h = response.Headers;
h.ProxyAuthenticate.TryParseAdd("Basic");
h.ProxyAuthenticate.Add(new HttpChallengeHeaderValue("digest", "token"));
var header = h.ProxyAuthenticate;
uiLog.Text += "\nPROXY AUTHENTICATE HEADER\n";
foreach (var item in header) {
// Parameters is an IList<HttpNameValueHeaderValue> of Name/Value strings
var parameterString = "";
foreach (var parameter in item.Parameters) {
parameterString += string.Format("[{0}={1}] ", parameter.Name, parameter.Value);
}
if (parameterString == "") {
parameterString = "(no parameters)";
}
uiLog.Text += string.Format("Scheme: {0} Token: {1} Parameters: {2} ToString(): {3}\n", item.Scheme, item.Token, parameterString, item.ToString());
}
uiLog.Text += String.Format("ProxyAuthenticate: {0}\n", header.ToString());
}
- See Also
RetryAfter RetryAfter RetryAfter RetryAfter
Gets or sets the HttpDateOrDeltaHeaderValue object that represent the value of a Retry-After HTTP header on an HTTP response.
public : HttpDateOrDeltaHeaderValue RetryAfter { get; set; }public HttpDateOrDeltaHeaderValue RetryAfter { get; set; }Public ReadWrite Property RetryAfter As HttpDateOrDeltaHeaderValue// You can use this property in JavaScript.
- Value
- HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue
The object that represents the value of a Retry-After HTTP header on an HTTP response. A null value means that the header is absent.
- See Also
Size Size Size Size
Gets the number of objects in the HttpResponseHeaderCollection.
public : unsigned int Size { get; }This member is not implemented in C#This member is not implemented in VB.Net// You can use this property in JavaScript.
- Value
- unsigned int uint uint uint
The number of objects in the HttpResponseHeaderCollection.
Remarks
The Size property returns the true number of items.
If you are programming using C# or Microsoft Visual Basic, the equivalent method is Count.
TransferEncoding TransferEncoding TransferEncoding TransferEncoding
Gets the HttpTransferCodingHeaderValueCollection of HttpTransferCodingHeaderValue objects that represent the value of a Transfer-Encoding HTTP header on an HTTP response.
public : HttpTransferCodingHeaderValueCollection TransferEncoding { get; }public HttpTransferCodingHeaderValueCollection TransferEncoding { get; }Public ReadOnly Property TransferEncoding As HttpTransferCodingHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpTransferCodingHeaderValueCollection HttpTransferCodingHeaderValueCollection HttpTransferCodingHeaderValueCollection HttpTransferCodingHeaderValueCollection
The collection of HttpTransferCodingHeaderValue objects that represent the value of a Transfer-Encoding HTTP header on an HTTP response. An empty collection means that the header is absent.
Remarks
The following sample code shows a method to get and set the Transfer-Encoding header on an HttpResponseMessage object using the TransferEncoding property on the HttpResponseHeaderCollection object.
// HttpTransferCodingHeaderValueCollection
// HttpTransferCodingHeaderValue hasValue (string) and Parameters (IList<HttpNameValueHeaderValue>)
// IList<HttpNameValueHeaderValue>
// HttpNameValueHeaderValue
//
// This is the same type as on the Request TransferEncoding value
void DemoTransferEncoding(HttpResponseMessage response) {
var h = response.Headers;
h.TransferEncoding.TryParseAdd("Basic");
h.TransferEncoding.Add(new HttpTransferCodingHeaderValue("gzip"));
var header = h.TransferEncoding;
uiLog.Text += "\nTRANSFER ENCODING HEADER\n";
foreach (var item in header) {
// Parameters is an IList<HttpNameValueHeaderValue> of Name/Value strings
var parameterString = "";
foreach (var parameter in item.Parameters) {
parameterString += string.Format("[{0}={1}] ", parameter.Name, parameter.Value);
}
if (parameterString == "") {
parameterString = "(no parameters)";
}
uiLog.Text += string.Format("Value: {0} Parameters: {1} ToString(): {2}\n", item.Value, parameterString, item.ToString());
}
uiLog.Text += String.Format("TransferEncoding: {0}\n", header.ToString());
}
- See Also
Values Values Values Values
Gets an System.Collections.Generic.ICollection`1 containing the values in the System.Collections.Generic.IDictionary`2.
This member is not implemented in C++ICollection<TValue> Values { get; }ReadOnly Property Values As ICollection(Of TValue)ICollection<TValue> Values { get; }
- Value
An System.Collections.Generic.ICollection`1 containing the values in the object that implements System.Collections.Generic.IDictionary`2.
WwwAuthenticate WwwAuthenticate WwwAuthenticate WwwAuthenticate
Gets the HttpChallengeHeaderValueCollection of HttpChallengeHeaderValue objects that represent the value of a WWW-Authenticate HTTP header on an HTTP response.
public : HttpChallengeHeaderValueCollection WwwAuthenticate { get; }public HttpChallengeHeaderValueCollection WwwAuthenticate { get; }Public ReadOnly Property WwwAuthenticate As HttpChallengeHeaderValueCollection// You can use this property in JavaScript.
- Value
- HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection HttpChallengeHeaderValueCollection
The collection of HttpChallengeHeaderValue objects that represent the value of a WWW-Authenticate HTTP header on an HTTP response. An empty collection means that the header is absent.
Remarks
The following sample code shows a method to get and set the WWW-Authenticate header on an HttpResponseMessage object using the WwwAuthenticate property on the HttpResponseHeaderCollection object.
// WWW-Authenticate: Basic
// HttpChallengeHeaderValueCollection
// HttpChallengeHeaderValue has Scheme and Token (both string) and Parameters (IList<HtpNameValueHeaderValue>)
// IList<HtpNameValueHeaderValue>
// HtpNameValueHeaderValue
void DemoWwwAuthenticate(HttpResponseMessage response) {
var h = response.Headers;
h.WwwAuthenticate.TryParseAdd("Basic");
h.WwwAuthenticate.Add(new HttpChallengeHeaderValue("scheme", "token"));
var header = h.WwwAuthenticate;
uiLog.Text += "\nWWW AUTHENTICATE HEADER\n";
foreach (var item in header) {
// Parameters is an IList<HttpNameValueHeaderValue> of Name/Value strings
var parameterString = "";
foreach (var parameter in item.Parameters) {
parameterString += string.Format("[{0}={1}] ", parameter.Name, parameter.Value);
}
if (parameterString == "") {
parameterString = "(no parameters)";
}
uiLog.Text += string.Format("Scheme: {0} Token: {1} Parameters: {2} ToString(): {3}\n", item.Scheme, item.Token, parameterString, item.ToString());
}
uiLog.Text += String.Format("WwwAuthenticate: {0}\n", header.ToString());
}
- See Also
Methods
Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)
Adds an element with the provided key and value to the System.Collections.Generic.IDictionary`2.
This member is not implemented in C++void Add(TKey key, TValue value)Sub Add(key As TKey, value As TValue)void Add(TKey key, TValue value)
- key
- TKey TKey TKey TKey
The object to use as the key of the element to add.
- value
- TValue TValue TValue TValue
The object to use as the value of the element to add.
key is null.
An element with the same key already exists in the System.Collections.Generic.IDictionary`2.
The System.Collections.Generic.IDictionary`2 is read-only.
Append(String, String) Append(String, String) Append(String, String) Append(String, String)
Adds a new item to the end of the HttpResponseHeaderCollection.
public : void Append(PlatForm::String name, PlatForm::String value)public void Append(String name, String value)Public Function Append(name As String, value As String) As void// You can use this method in JavaScript.
- name
- PlatForm::String String String String
The name of the value to add.
- value
- PlatForm::String String String String
The item value to add.
- See Also
Clear() Clear() Clear() Clear()
Removes all objects from the collection.
public : void Clear()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)
Determines whether the System.Collections.Generic.IDictionary`2 contains an element with the specified key.
This member is not implemented in C++bool ContainsKey(TKey key)Function ContainsKey(key As TKey) As Booleanbool ContainsKey(TKey key)
- key
- TKey TKey TKey TKey
The key to locate in the System.Collections.Generic.IDictionary`2.
true if the System.Collections.Generic.IDictionary`2 contains an element with the key; otherwise, false.
key is null.
First() First() First() First()
Retrieves an iterator to the first item in the HttpResponseHeaderCollection.
public : IIterator<IKeyValuePair<PlatForm::String, PlatForm::String>> First()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
An object that can be used to enumerate the items in the collection. The iterator points to the first item in the HttpResponseHeaderCollection.
GetEnumerator() GetEnumerator() GetEnumerator() GetEnumerator()
Returns an enumerator that iterates through the collection.
This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)IEnumerator<T> GetEnumerator()
An enumerator that can be used to iterate through the collection.
GetView() GetView() GetView() GetView()
Returns an immutable view of the HttpResponseHeaderCollection.
public : IMapView<PlatForm::String, PlatForm::String> GetView()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
The view of the HttpResponseHeaderCollection.
Remarks
When programming with .NET, this method is hidden.
HasKey(String) HasKey(String) HasKey(String) HasKey(String)
Determines whether the HttpResponseHeaderCollection contains the specified key.
public : PlatForm::Boolean HasKey(PlatForm::String key)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
- key
- PlatForm::String String String String
The key associated with the item to locate.
true if the key is found; otherwise, false.
Remarks
When programming with .NET, this method is hidden and developers should use ContainsKey.
Insert(String, String) Insert(String, String) Insert(String, String) Insert(String, String)
Inserts or replaces an item in the HttpResponseHeaderCollection with the specified key and value.
public : PlatForm::Boolean Insert(PlatForm::String key, PlatForm::String value)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
- key
- PlatForm::String String String String
The key of the item to be inserted.
- value
- PlatForm::String String String String
The value of the item to insert.
true if an item with the specified key is an existing item that was replaced; otherwise false.
Remarks
When programming with .NET, this method is hidden and developers should use one of the Add methods.
Lookup(String) Lookup(String) Lookup(String) Lookup(String)
Lookup an item in the HttpResponseHeaderCollection.
public : PlatForm::String Lookup(PlatForm::String key)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
- key
- PlatForm::String String String String
The key of the item to lookup.
The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.
Remarks
Use the HasKey method to determine whether the key exists in the HttpResponseHeaderCollection.
When programming with .NET, this method is hidden and developers should use the Item indexer.
Remove(TKey) Remove(TKey) Remove(TKey) Remove(TKey)
Removes the element with the specified key from the System.Collections.Generic.IDictionary`2.
This member is not implemented in C++bool Remove(TKey key)Function Remove(key As TKey) As Booleanbool Remove(TKey key)
- key
- TKey TKey TKey TKey
The key of the element to remove.
true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary`2.
key is null.
The System.Collections.Generic.IDictionary`2 is read-only.
Remove(String) Remove(String) Remove(String) Remove(String)
Removes an item with a given key from the HttpResponseHeaderCollection.
public : void Remove(PlatForm::String key)This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
- key
- PlatForm::String String String String
Key of the item to be removed.
ToString() ToString() ToString() ToString()
Returns a string that represents the current HttpResponseHeaderCollection object.
public : PlatForm::String ToString()public string ToString()Public Function ToString() As string// You can use this method in JavaScript.
A string that represents the current object.
TryAppendWithoutValidation(String, String) TryAppendWithoutValidation(String, String) TryAppendWithoutValidation(String, String) TryAppendWithoutValidation(String, String)
Try to append the specified item to the HttpResponseHeaderCollection without validation.
public : PlatForm::Boolean TryAppendWithoutValidation(PlatForm::String name, PlatForm::String value)public bool TryAppendWithoutValidation(String name, String value)Public Function TryAppendWithoutValidation(name As String, value As String) As bool// You can use this method in JavaScript.
- name
- PlatForm::String String String String
The name of the item to append.
- value
- PlatForm::String String String String
The value of the item to append.
true if the item was appended; otherwise false.
Remarks
The TryAppendWithoutValidation method is available when you need to work with an HTTP header on an HTTP response that doesn't have a strongly-typed class for the HTTP header. If there is a strongly-typed implementation of the HTTP header, then the methods and properties on the strongly-typed class should be used instead of the TryAppendWithoutValidation method.
TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue)
Gets the value associated with the specified key.
This member is not implemented in C++bool TryGetValue(TKey key, out TValue value)Function TryGetValue(key As TKey, ByRef value As TValue) As Booleanbool TryGetValue(TKey key, out TValue value)
- key
- TKey TKey TKey TKey
The key whose value to get.
- value
- TValue TValue TValue TValue
When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.
true if the object that implements System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.
key is null.