Networking
System
[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]
1.0.x.x
1.0.5000.0
2.0.0.0
4.0.0.0
All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.
System.Object
System.Net.IWebProxy
System.Runtime.Serialization.ISerializable
The following example sets a for a
. The instance uses the proxy to
connect to external Internet resources.
using System;
using System.Net;
public class WebProxyExample {
public static void Main() {
WebProxy proxyObject =
new WebProxy("http://proxyserver:80/",true);
WebRequest req =
WebRequest.Create("http://www.contoso.com");
req.Proxy = proxyObject;
}
}
The class contains the proxy settings that instances use to determine whether a Web proxy is used to send requests. Global Web proxy settings can be specified in machine and application configuration files, and applications can use instances of the class to customize Web proxy use. The class is the base implementation of the interface.
To obtain instances of the Web proxy class, you can use any of the following methods:
-
The constructor.
-
The method.
-
The method.
These methods each supply a instance that you can further customize; the difference between them is how the instance is initialized before it is returned to your application. The constructor returns an instance of the class with the property set to null. When a request uses a instance in this state, no proxy is used to send the request.
The method returns an instance of the class with the , , and properties set to the values used by Internet Explorer 5.5 and later.
The method returns an instance of the class with it properties set according to a combination of Internet Explorer and configuration file settings.
The class supports automatic detection and execution of proxy configuration scripts. This feature is also known as Web Proxy Auto-Discovery (WPAD). When using automatic proxy configuration, a configuration script, typically named Wpad.dat, must be located, downloaded, compiled, and run. If these operations are successful, the script returns the proxies that can be used for a request.
Contains HTTP proxy settings for the class.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
The default constructor initializes an empty instance of the class with the property set to null.
When the property is null, the method returns true and the method returns the destination address.
Initializes an empty instance of the class.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
A containing the URI of the proxy server.
is not and not in a valid URI format.
The instance is initialized with the property set to a instance containing .
Initializes a new instance of the class with the specified URI.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
A containing the address of the proxy server.
The instance is initialized with the property set to the parameter.
Initializes a new instance of the class from the specified instance.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
This method is called by the system to deserialize a instance; applications do not call it.
Initializes an instance of the class using previously serialized content.
The serialization data.
The context for the serialized data.
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
is not in a valid URI format.
The instance is initialized with the property set to a instance that contains and the property set to .
Initializes a new instance of the class with the specified URI and bypass setting.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
The URI formed by combining and is not in a valid URI format.
The instance is initialized with the property set to a instance of the form http:// : .
Initializes a new instance of the class with the specified host and port number.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
The instance is initialized with the property set to and with the property set to .
Initializes a new instance of the class with the instance and bypass setting.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
To be added.
is not in a valid URI format.
The instance is initialized with the property set to a instance that contains , the property set to , and the property set to .
Initializes a new instance of the class with the specified URI, bypass setting, and list of URIs to bypass.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
To be added.
The instance is initialized with the property set to , the property set to , and the property set to .
Initializes a new instance of the class with the specified instance, bypass setting, and list of URIs to bypass.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
To be added.
To be added.
is not in a valid URI format.
The instance is initialized with the property set to a instance that contains , the property set to , the property set to , and the property set to .
Initializes a new instance of the class with the specified URI, bypass setting, list of URIs to bypass, and credentials.
0
Constructor
1.0.5000.0
2.0.0.0
4.0.0.0
To be added.
To be added.
To be added.
To be added.
The instance is initialized with the property set to , the property set to , the property set to , and the property set to .
Initializes a new instance of the class with the specified instance, bypass setting, list of URIs to bypass, and credentials.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Uri
A containing the
address of the proxy server represented by the current instance.
The property contains the address of the proxy server. When automatic proxy detection is not enabled, and no automatic configuration script is specified, the property and determine the proxy used for a request.
When the property is null, requests bypass the proxy and connect directly to the destination host.
Gets or sets the address of the proxy server.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Collections.ArrayList
A of
instances. The elements of
the list represent the URIs that a
instance accesses directly instead of through the proxy server.
The is an array list of regular expression strings that describe the URIs that a instance accesses directly instead of through the proxy server.
Gets a list of addresses that do not use the proxy server.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.String[]
A of instances. The elements of the array represent URIs that
a
instance accesses directly instead of through the
proxy server.
The property contains an array of regular expressions that describe URIs that a instance accesses directly instead of through the proxy server.
Gets or sets an array of addresses that do not use the proxy server.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Boolean
to bypass the proxy server for local resources;
otherwise, . The default value is
.
The setting of the property determines whether instances use the proxy server when accessing local Internet resources.
If is true, requests to local Internet resources do not use the proxy server. Local requests are identified by the lack of a period (.) in the URI, as in http://webserver/, or access the local server, including http://localhost, http://loopback, or http://127.0.0.1. When is false, all Internet requests are made through the proxy server.
Requests to a local host with a URI that contain a period use the proxy. To avoid using a proxy in these cases, create an entry for the host in the .
Gets or sets a value that indicates whether to bypass the proxy server for local addresses.
0
Property
1.0.5000.0
2.0.0.0
4.0.0.0
System.Net.ICredentials
A object
containing the credentials to submit to the proxy server
for authentication.
The property contains the authentication credentials to send to the proxy server in response to an HTTP 407 (proxy authorization) status code. In most client scenarios, you should use the , which are the credentials of the currently logged on user. To do this, set the property to true instead of setting this property.
If you set the property to credentials other than the , setting the property to true causes a . To prevent this, you must set the property to null before setting the property to true. Likewise, you cannot set this property to any value when is true.
Gets or sets the credentials to submit to the proxy server for authentication.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.MonoTODO("Can we get this info under windows from the system?")
System.Obsolete("This method has been deprecated", false)
System.Net.WebProxy
The method reads the nondynamic proxy settings stored by Internet Explorer 5.5 and later, and creates a instance with those settings.
The method does not pick up any dynamic settings that are generated from scripts run by Internet Explorer, from automatic configuration entries, or from DHCP or DNS lookups.
Applications should use the property and the method instead of the method.
Reads the Internet Explorer nondynamic proxy settings.
A instance that contains the nondynamic proxy settings from Internet Explorer 5.5 and later.
0
Method
2.0.0.0
4.0.0.0
System.Void
Any objects included in the are automatically tracked and serialized by the formatter.
Populates a with the data that is needed to serialize the target object.
The to populate with data.
A that specifies the destination for this serialization.
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Uri
The method returns the URI that the instance uses to access the Internet resource.
compares with the contents of , using the method. If returns true, returns and the instance does not use the proxy server.
If is not in , the instance uses the proxy server and the property is returned.
Returns the proxied URI for a request.
The instance of the Internet resource, if the resource is on the bypass list; otherwise, the instance of the proxy.
The instance of the requested Internet resource.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Boolean
The of the current instance contains an invalid regular expression.
The method is used to determine whether to bypass the proxy server when accessing an Internet resource.
The and properties control the return value of the method.
returns true under any of the following conditions:
-
If is true and is a local URI. Local requests are identified by the lack of a period (.) in the URI, as in "http://webserver/".
-
If matches a regular expression in .
-
If is null.
All other conditions return false.
Indicates whether to use the proxy server for the specified host.
true if the proxy server should not be used for ; otherwise, false.
The instance of the host to check for proxy use.
0
Method
1.0.5000.0
2.0.0.0
4.0.0.0
System.Void
The system calls this method to serialize an object; applications do not call it directly.
Creates the serialization data and context that are used by the system to serialize a object.
The object to populate with data.
A structure that indicates the destination for this serialization.
Property
2.0.0.0
4.0.0.0
System.MonoTODO("Does not affect Credentials, since CredentialCache.DefaultCredentials is not implemented.")
System.Boolean
To be added.
Set this property to true when requests made by this object should, if requested by the server, be authenticated using the credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios. For middle tier applications, such as ASP.NET applications, instead of using this property, you would typically set the property to the credentials of the client on whose behalf the request is made.
The following table shows the effect of setting the value, based on the value of the property.
-
value
value
Effect
-
true
No effect.
-
false
is set to null.
-
null
true
is set to .
-
Any value other than or null
true or false
Setting throws an exception.
If is false, you can change the property to any credentials. If is true, changing the property from (the value that is set when the property is set to true) will throw an exception.
Gets or sets a value that controls whether the are sent with requests.
0