コード例 #1
0
        public RTHttpClientHandler()
        {
            _rtFilter        = new RTHttpBaseProtocolFilter();
            _handlerToFilter = new RTHttpHandlerToFilter(_rtFilter);
            InnerHandler     = _handlerToFilter;

            // TODO: Fix up client certificate options
            _clientCertificates = new X509Certificate2Collection();

            InitRTCookieUsageBehavior();

            _useCookies      = true;                  // deal with cookies by default.
            _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            // Managed at this layer for granularity, but uses the desktop default.
            _rtFilter.AutomaticDecompression = false;
            _automaticDecompression          = DecompressionMethods.None;

            // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses.
            _rtFilter.AllowUI = false;

            // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default.
            // To preserve app-compat, we turn off caching (as much as possible) in the WinRT HttpClient APIs.
            _rtFilter.CacheControl.ReadBehavior  = RTHttpCacheReadBehavior.MostRecent;
            _rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache;
        }
コード例 #2
0
ファイル: RTHttpClientHandler.cs プロジェクト: mehtavipul/wcf
        public RTHttpClientHandler()
        {
            _rtFilter = new RTHttpBaseProtocolFilter();
            _handlerToFilter = new RTHttpHandlerToFilter(_rtFilter);
            InnerHandler = _handlerToFilter;

            // TODO: Fix up client certificate options
            _clientCertificates = new X509Certificate2Collection();

            InitRTCookieUsageBehavior();

            _useCookies = true; // deal with cookies by default.
            _cookieContainer = new CookieContainer(); // default container used for dealing with auto-cookies.

            // Managed at this layer for granularity, but uses the desktop default.
            _rtFilter.AutomaticDecompression = false;
            _automaticDecompression = DecompressionMethods.None;

            // We don't support using the UI model in HttpBaseProtocolFilter() especially for auto-handling 401 responses.
            _rtFilter.AllowUI = false;

            // The .NET Desktop System.Net Http APIs (based on HttpWebRequest/HttpClient) uses no caching by default.
            // To preserve app-compat, we turn off caching (as much as possible) in the WinRT HttpClient APIs.
            _rtFilter.CacheControl.ReadBehavior = RTHttpCacheReadBehavior.MostRecent;
            _rtFilter.CacheControl.WriteBehavior = RTHttpCacheWriteBehavior.NoCache;
        }