The Labs \ Source Viewer \ SSCLI \ System.Net \ EmptyWebProxy

  1. //------------------------------------------------------------------------------
  2. // <copyright file="_emptywebproxy.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Net
  16. {
  17.     using System.Collections.Generic;
  18.    
  19.     [Serializable()]
  20.     internal sealed class EmptyWebProxy : IAutoWebProxy
  21.     {
  22.        
  23.         [NonSerialized()]
  24.         private ICredentials m_credentials;
  25.        
  26.         public EmptyWebProxy()
  27.         {
  28.         }
  29.        
  30.         //
  31.         // IWebProxy interface
  32.         //
  33.         public Uri GetProxy(Uri uri)
  34.         {
  35.             // this method won't get called by NetClasses because of the IsBypassed test below
  36.             return uri;
  37.         }
  38.         public bool IsBypassed(Uri uri)
  39.         {
  40.             return true;
  41.             // no proxy, always bypasses
  42.         }
  43.         public ICredentials Credentials {
  44.             get { return m_credentials; }
  45.                 // doesn't do anything, but doesn't break contract either
  46.             set { m_credentials = value; }
  47.         }
  48.        
  49.         //
  50.         // IAutoWebProxy interface
  51.         //
  52.         ProxyChain IAutoWebProxy.GetProxies(Uri destination)
  53.         {
  54.             return new DirectProxy(destination);
  55.         }
  56.     }
  57. }

Developer Fusion