Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Gibt eine leere Proxyinstanz zurück.
Namespace: System.Net
Assembly: System (in system.dll)
Syntax
'Declaration
Public Shared Function GetEmptyWebProxy As IWebProxy
'Usage
Dim returnValue As IWebProxy
returnValue = GlobalProxySelection.GetEmptyWebProxy
public static IWebProxy GetEmptyWebProxy ()
public:
static IWebProxy^ GetEmptyWebProxy ()
public static IWebProxy GetEmptyWebProxy ()
public static function GetEmptyWebProxy () : IWebProxy
Rückgabewert
Ein IWebProxy, der keine Informationen enthält.
Hinweise
Die GetEmptyWebProxy-Methode gibt eine leere IWebProxy-Instanz zurück, um anzugeben, dass für den Zugriff auf eine Internetressource kein Proxy verwendet wird.
Beispiel
Im folgenden Codebeispiel wird eine WebRequest-Instanz erstellt, die keinen Proxy verwendet.
using System;
using System.Net;
using System.IO;
namespace Examples.Http
{
public class TestGlobalProxySelection
{
public static void Main()
{
// Create a request for the Web page at www.contoso.com.
WebRequest request = WebRequest.Create("https://www.contoso.com");
// This application doesn't want the proxy to be used so it sets
// the global proxy to an empty proxy.
IWebProxy myProxy = GlobalProxySelection.GetEmptyWebProxy();
GlobalProxySelection.Select = myProxy;
// Get the response.
WebResponse response = request.GetResponse();
// Display the response to the console.
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
Console.WriteLine(reader.ReadToEnd());
// Clean up.
reader.Close();
stream.Close();
response.Close();
}
}
}
#using <System.dll>
using namespace System;
using namespace System::Net;
using namespace System::IO;
int main()
{
// Create a request for the Web page at www.contoso.com.
WebRequest^ request = WebRequest::Create( L"https://www.contoso.com" );
// 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 = gcnew StreamReader( stream );
Console::WriteLine( reader->ReadToEnd() );
// Clean up.
reader->Close();
stream->Close();
response->Close();
return 0;
}
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 www.contoso.com.
WebRequest request = WebRequest.Create("https://www.contoso.com");
// This application doesn't want they proxy to be used so it sets
// the global proxy to an empy proxy.
IWebProxy myProxy = GlobalProxySelection.GetEmptyWebProxy();
GlobalProxySelection.set_Select(myProxy);
// Get the response.
WebResponse response = request.GetResponse();
// Display the response to the console.
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
Console.WriteLine(reader.ReadToEnd());
// Clean up.
reader.Close();
stream.Close();
response.Close();
} //main
} //TestGlobalProxySelection
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
GlobalProxySelection-Klasse
GlobalProxySelection-Member
System.Net-Namespace