_emptywebproxy.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Net / System / Net / _emptywebproxy.cs / 1 / _emptywebproxy.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Net 
{ 
    using System.Collections.Generic;
 
    [Serializable]
    internal sealed class EmptyWebProxy : IAutoWebProxy {

        [NonSerialized] 
        private ICredentials m_credentials;
 
        public EmptyWebProxy() { 
        }
 
        //
        // IWebProxy interface
        //
        public Uri GetProxy(Uri uri) { 
            // this method won't get called by NetClasses because of the IsBypassed test below
            return uri; 
        } 
        public bool IsBypassed(Uri uri) {
            return true; // no proxy, always bypasses 
        }
        public ICredentials Credentials {
            get {
                return m_credentials; 
            }
            set { 
                m_credentials = value; // doesn't do anything, but doesn't break contract either 
            }
        } 

        //
        // IAutoWebProxy interface
        // 
        ProxyChain IAutoWebProxy.GetProxies(Uri destination)
        { 
            return new DirectProxy(destination); 
        }
    } 
}


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK