Windows Runtime via C# by Jeffrey Richter & Maarten van de Bospoort
Author:Jeffrey Richter & Maarten van de Bospoort [Jeffrey Richter and Maarten van de Bospoort]
Language: eng
Format: epub
Tags: COMPUTERS / Programming / Microsoft
ISBN: 9780735679221
Publisher: Microsoft Press
Published: 2013-11-07T16:00:00+00:00
HttpBaseProtocolFilter
WinRT defines a Windows.Web.Http.Filters.HttpBaseProtocolFilter class. When you construct an HttpClient object using its default constructor, the object uses an instance of the HttpBaseProtocolFilter class internally. It is the HttpBaseProtocolFilter object that establishes the TCP socket connection with the server, sends the bytes to it, and receives the response bytes back. In addition, this filter manages caching, cookies, credentials, and a slew of other communication parameters. The class looks like this:
public sealed class HttpBaseProtocolFilter : IHttpFilter, IDisposable { public HttpBaseProtocolFilter(); // Gets an object allowing you to set cache read and write behavior public HttpCacheControl CacheControl { get; } // Returns the cookie manager allowing you to get and set cookies public HttpCookieManager CookieManager { get; } // Allows you to set the maximum connections from filter to an HTTP server public UInt32 MaxConnectionsPerServer { get; set; } // Can filter follow a redirect response (default = true) public Boolean AllowAutoRedirect { get; set; } // Can filter automatically decompress response data (default = true) public Boolean AutomaticDecompression { get; set; } // Ignorable SSL errors public IList<ChainValidationResult> IgnorableServerCertificateErrors { get; } // Can filter use a proxy to send request public Boolean UseProxy { get; set; } // Sets HTTP proxy credentials public PasswordCredential ProxyCredential { get; set; } // Sets client certificate to send to server (if requested) public Certificate ClientCertificate { get; set; } // Sets HTTP server credentials public PasswordCredential ServerCredential { get; set; } // Can filter prompt for user credentials at server's request (default = true) public Boolean AllowUI { get; set; } // Sends HTTP request over the wire (SendRequestAsync is IHttpFilter's only member) public IAsyncOperationWithProgress<HttpResponseMessage, HttpProgress> SendRequestAsync(HttpRequestMessage request); // Releases unmanaged resources associated with the HttpBaseProtocolFilter public void Dispose(); }
Each package has a per-user cache that can hold downloaded HTTP content.[55] This prevents one package’s downloaded content from being visible to another package’s app, and it also prevents content downloaded by one user from being visible to another user who happens to be using the same package. Using HttpBaseProtocolFilter’s CacheControl property, your app can control how HTTP responses are cached on the user’s local machine and use this to alter your app’s performance.
Before making an HTTP request, you can set CacheControl’s ReadBehavior to Default (as described in RFC 2616), MostRecent (if the server has more recent data, get it; otherwise, use cached data),[56] or OnlyFromCache (get data from cache [useful when a PC is offline or at app startup time to show what’s cached quickly]). You can also set CacheControl’s WriteBehavior to control how the read data gets put into the user’s local cache. The possible values are Default (save the response in the local cache) and NoCache (do not save the response in the local cache [useful when streaming media]). When your app gets a response back, HttpResponseMessage’s Source property indicates whether the response came from the server or from the user’s local cache.
Here is an example that reads the most recent data from the server (or cache if it exists there);
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
NET | C & C++ Windows Programming |
SQL Server | VBA |
Visual Basic |
Deep Learning with Python by François Chollet(12520)
Hello! Python by Anthony Briggs(9867)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9757)
The Mikado Method by Ola Ellnestam Daniel Brolund(9747)
Dependency Injection in .NET by Mark Seemann(9293)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8258)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7741)
Grails in Action by Glen Smith Peter Ledbrook(7667)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7517)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(6743)
Microservices with Go by Alexander Shuiskov(6510)
Practical Design Patterns for Java Developers by Miroslav Wengner(6408)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6386)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6378)
Angular Projects - Third Edition by Aristeidis Bampakos(5765)
The Art of Crafting User Stories by The Art of Crafting User Stories(5296)
NetSuite for Consultants - Second Edition by Peter Ries(5241)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5058)
Kotlin in Action by Dmitry Jemerov(5019)
