_emptywebproxy.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     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); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

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