GlobalProxySelection.GetEmptyWebProxy Method

Returns an empty proxy instance.

Namespace: System.Net
Assembly: System (in system.dll)

Public Shared Function GetEmptyWebProxy As IWebProxy
Dim returnValue As IWebProxy

returnValue = GlobalProxySelection.GetEmptyWebProxy
public static IWebProxy GetEmptyWebProxy ()
public static function GetEmptyWebProxy () : IWebProxy

Return Value

An IWebProxy that contains no information.

The GetEmptyWebProxy method returns a blank IWebProxy instance to indicate that no proxy is used to access an Internet resource.

The following code example creates a WebRequest instance that does not use a proxy.

No code example is currently available or this language may not be supported.
package Examples.Http;

import System.*;
import System.Net.*;
import System.IO.*;

public class TestGlobalProxySelection
    public static void main(String[] args)
        // Create a request for the Web page at
        WebRequest request = WebRequest.Create("");
        // This application doesn't want they proxy to be used so it sets 
        // the global proxy to an empy proxy.
        IWebProxy myProxy = GlobalProxySelection.GetEmptyWebProxy();
        // Get the response.
        WebResponse response = request.GetResponse();
        // Display the response to the console.
        Stream stream = response.GetResponseStream();
        StreamReader reader = new StreamReader(stream);
        // Clean up.
    } //main
} //TestGlobalProxySelection

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0