HttpResponseHeaderCollection.ProxyAuthenticate | proxyAuthenticate property

Applies to Windows and Windows Phone

Gets the HttpChallengeHeaderValueCollection of HttpChallengeHeaderValue objects that represent the value of a Proxy-Authenticate HTTP header on an HTTP response.

Syntax


var proxyAuthenticate = httpResponseHeaderCollection.proxyAuthenticate;

Property value

Type: 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());
    }



Requirements

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

HttpChallengeHeaderValue
HttpChallengeHeaderValueCollection
HttpResponseHeaderCollection
HttpResponseMessage
HttpResponseMessage.Headers

 

 

Show:
© 2014 Microsoft