/// <summary> /// Initializes a new instance of a concrete derivation of <see cref="HttpMessageHandler" /> /// to be used for outbound HTTP traffic. /// </summary> /// <returns>An instance of <see cref="HttpMessageHandler"/>.</returns> /// <remarks> /// An instance of <see cref="WebRequestHandler" /> is recommended where available; /// otherwise an instance of <see cref="HttpClientHandler" /> is recommended. /// </remarks> public virtual HttpMessageHandler CreateHttpMessageHandler() { var handler = new UntrustedWebRequestHandler(); ((WebRequestHandler)handler.InnerHandler).CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); return(handler); }
public HttpMessageHandler CreateHttpMessageHandler() { var forwardingMessageHandler = new ForwardingMessageHandler(this.Handlers, this); var cookieDelegatingHandler = new CookieDelegatingHandler(forwardingMessageHandler, this.CookieContainer); if (this.InstallUntrustedWebReqestHandler) { var untrustedHandler = new UntrustedWebRequestHandler(cookieDelegatingHandler); untrustedHandler.AllowAutoRedirect = this.AllowAutoRedirects; return untrustedHandler; } else if (this.AllowAutoRedirects) { return new AutoRedirectHandler(cookieDelegatingHandler); } else { return cookieDelegatingHandler; } }
/// <summary> /// Initializes a new instance of a concrete derivation of <see cref="HttpMessageHandler" /> /// to be used for outbound HTTP traffic. /// </summary> /// <returns>An instance of <see cref="HttpMessageHandler"/>.</returns> /// <remarks> /// An instance of <see cref="WebRequestHandler" /> is recommended where available; /// otherwise an instance of <see cref="HttpClientHandler" /> is recommended. /// </remarks> public virtual HttpMessageHandler CreateHttpMessageHandler() { var handler = new UntrustedWebRequestHandler(); ((WebRequestHandler)handler.InnerHandler).CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore); return handler; }