IWebProxy.IsBypassed(Uri) Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Proxy'nin belirtilen konak için kullanılmaması gerektiğini gösterir.
public:
bool IsBypassed(Uri ^ host);
public bool IsBypassed (Uri host);
abstract member IsBypassed : Uri -> bool
Public Function IsBypassed (host As Uri) As Boolean
Parametreler
Döndürülenler
true
proxy sunucusu için host
kullanılmamalıdır; değilse, false
.
Örnekler
Aşağıdaki örnek, proxy sunucusunun belirtilen konak için kullanılıp kullanılmayacağını belirlemek için özelliğini kullanır IsBypassed .
WebProxy_Interface^ webProxy_Interface = gcnew WebProxy_Interface( gcnew Uri( "http://proxy.example.com" ) );
webProxy_Interface->Credentials = gcnew NetworkCredential( "myusername", "mypassword" );
Console::WriteLine( "The web proxy is : {0}", webProxy_Interface->GetProxy( gcnew Uri( "http://www.contoso.com" ) ) );
// Check if the webproxy can ne bypassed for the site "http://www.contoso.com".
if ( webProxy_Interface->IsBypassed( gcnew Uri( "http://www.contoso.com" ) ) )
{
Console::WriteLine( "Web Proxy is by passed" );
}
else
{
Console::WriteLine( "Web Proxy is not by passed" );
}
WebProxy_Interface webProxy_Interface = new WebProxy_Interface(new Uri("http://proxy.example.com"));
webProxy_Interface.Credentials = new NetworkCredential("myusername", "mypassword");
Uri testUri = new Uri("http://www.contoso.com");
// Determine whether the Web proxy can be bypassed for the site "http://www.contoso.com".
if(webProxy_Interface.IsBypassed(testUri))
{
Console.WriteLine("Web Proxy is by passed");
}
else
{
Uri? webProxyServer = webProxy_Interface.GetProxy(testUri);
// In general, we wouldn't expect the condition (`webProxyServer! == testUri`) true here, if IsBypassed returns `false`.
// However, technically our interface can allow that.
if (webProxyServer is null || webProxyServer! == testUri)
{
Console.WriteLine("Web proxy is bypassed");
}
else
{
Console.WriteLine("Web proxy is not bypassed");
Console.WriteLine($"The web proxy is: {webProxyServer!}");
}
}
Public Shared Sub Main()
Dim webProxy_Interface As New WebProxy_Interface(New Uri("http://proxy.example.com"))
webProxy_Interface.Credentials = New NetworkCredential("myusername", "mypassword")
Console.WriteLine("The web proxy is : {0}", webProxy_Interface.GetProxy(New Uri("http://www.contoso.com")))
'Determine whether the Web proxy can be bypassed for the site "http://www.contoso.com".
console.writeline("For the Uri http://www.contoso.com , the ")
If webProxy_Interface.IsBypassed(New Uri("http://www.contoso.com")) Then
Console.WriteLine("webproxy is by passed")
Else
Console.WriteLine("webproxy is not bypassed")
End If
End Sub
Açıklamalar
IsBypassed yöntemi, parametresinde host
belirtilen konağa erişmek için ara sunucunun kullanılıp kullanılmayacağını gösterir. döndürürse IsBypassedtrue
, proxy ana bilgisayarla iletişim kurmak için kullanılmaz ve istek doğrudan sunucuya geçirilir. 'den IsBypassed almak false
URI'nin proksid olduğunu garanti etmez; bunu belirlemek için yine de yöntemini çağırmanız GetProxy gerekir.
Şunlara uygulanır
Geri Bildirim
https://aka.ms/ContentUserFeedback.
Çok yakında: 2024 boyunca, içerik için geri bildirim mekanizması olarak GitHub Sorunları’nı kullanımdan kaldıracak ve yeni bir geri bildirim sistemiyle değiştireceğiz. Daha fazla bilgi için bkz.Gönderin ve geri bildirimi görüntüleyin