System.Net.GlobalProxySelection Class

Assembly: System.dll
Namespace: System.Net
Summary
Contains a global default proxy instance for all HTTP requests.
C# Syntax:
public class GlobalProxySelection
Remarks
The GlobalProxySelection stores the proxy settings for the default proxy that WebRequest instances use to contact Internet sites beyond the local network. The default proxy setting is initialized from the global or application configuration file, and can be overridden for individual requests, or disabled by setting the HttpWebRequest.Proxy property to the result of the GlobalProxySelection.GetEmptyWebProxy method.

The proxy settings stored in GlobalProxySelection are used by any HttpWebRequest instances whose HttpWebRequest.Proxy property is not set to another value.



Note Changes to the GlobalProxySelection after a request is made are not reflected in a WebRequest.
Example
The following example sets the GlobalProxySelection for an HTTP proxy named "webproxy" on port 80.
Uri proxyURI = new Uri("http://webproxy:80");
 GlobalProxySelection.Select = new WebProxy(proxyURI);


    
See also:
System.Net Namespace

System.Net.GlobalProxySelection Member List:

Public Constructors
ctor #1 Default constructor. This constructor is called by derived class constructors to initialize state in this type.
Public Properties
Select Read-write

Gets or sets the global HTTP proxy.
Public Methods
Equals
(inherited from System.Object)
See base class member description: System.Object.Equals

Derived from System.Object, the primary base class for all objects.
GetEmptyWebProxy Returns an empty proxy instance.
GetHashCode
(inherited from System.Object)
See base class member description: System.Object.GetHashCode

Derived from System.Object, the primary base class for all objects.
GetType
(inherited from System.Object)
See base class member description: System.Object.GetType

Derived from System.Object, the primary base class for all objects.
ToString
(inherited from System.Object)
See base class member description: System.Object.ToString

Derived from System.Object, the primary base class for all objects.
Protected Methods
Finalize
(inherited from System.Object)
See base class member description: System.Object.Finalize

Derived from System.Object, the primary base class for all objects.
MemberwiseClone
(inherited from System.Object)
See base class member description: System.Object.MemberwiseClone

Derived from System.Object, the primary base class for all objects.

Hierarchy:


System.Net.GlobalProxySelection Member Details

ctor #1
Summary:
Default constructor. This constructor is called by derived class constructors to initialize state in this type.
C# Syntax:
public GlobalProxySelection();

Return to top


Property: Select (read-write)
Summary
Gets or sets the global HTTP proxy.
C# Syntax:
public static IWebProxy Select {get; set;}
Remarks
The GlobalProxySelection.Select method sets the proxy that all HttpWebRequest instances use.
.NET Framework Security:
WebPermission To get or set the global HTTP proxy. Associated enumeration: PermissionState

Return to top


Method: Equals(
   object obj
)
Inherited
See base class member description: System.Object.Equals
C# Syntax:
public virtual bool Equals(
   object obj
);

For more information on members inherited from System.Object click on the link above.

Return to top


Method: Finalize()
Inherited
See base class member description: System.Object.Finalize
C# Syntax:
~GlobalProxySelection();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetEmptyWebProxy()
Summary
Returns an empty proxy instance.
C# Syntax:
public static IWebProxy GetEmptyWebProxy();
Return Value:
An IWebProxy that contains no information.
Remarks
The GlobalProxySelection.GetEmptyWebProxy method returns a blank IWebProxy instance to indicate that no proxy is used to access an Internet resource.
Example
The following example creates a WebRequest instance that does not use a proxy to contact an Internet resource.
WebRequest myReq = WebRequest.Create("http://www.contoso.com/");
myReq.Proxy = GlobalProxySelection.GetEmptyWebProxy();


    

Return to top


Method: GetHashCode()
Inherited
See base class member description: System.Object.GetHashCode
C# Syntax:
public virtual int GetHashCode();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: GetType()
Inherited
See base class member description: System.Object.GetType
C# Syntax:
public Type GetType();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: MemberwiseClone()
Inherited
See base class member description: System.Object.MemberwiseClone
C# Syntax:
protected object MemberwiseClone();

For more information on members inherited from System.Object click on the link above.

Return to top


Method: ToString()
Inherited
See base class member description: System.Object.ToString
C# Syntax:
public virtual string ToString();

For more information on members inherited from System.Object click on the link above.

Return to top


Top of page

Copyright (c) 2002 Microsoft Corporation. All rights reserved.