WebProxy.GetProxy(Uri) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
요청에 대한 프록시된 URI를 반환합니다.
public:
virtual Uri ^ GetProxy(Uri ^ destination);
public Uri? GetProxy(Uri destination);
public Uri GetProxy(Uri destination);
abstract member GetProxy : Uri -> Uri
override this.GetProxy : Uri -> Uri
Public Function GetProxy (destination As Uri) As Uri
매개 변수
반환
Uri 리소스가 바이패스 목록에 있으면 인터넷 리소스의 인스턴스이고, Uri 그렇지 않으면 프록시 인스턴스입니다.
구현
예외
매개 변수는 destination .입니다 null.
예제
다음 코드 예제에서는 개체를 WebProxy 만들고 이 메서드를 호출하여 리소스에 대해 선택된 프록시를 가져옵니다.
// The following method creates a WebProxy object that uses Internet Explorer's
// detected script if it is found in the registry; otherwise, it
// tries to use Web proxy auto-discovery to set the proxy used for
// the request.
public static void CheckAutoGlobalProxyForRequest(Uri resource)
{
WebProxy proxy = new WebProxy();
// Display the proxy's properties.
DisplayProxyProperties(proxy);
// See what proxy is used for the resource.
Uri resourceProxy = proxy.GetProxy(resource);
// Test to see whether a proxy was selected.
if (resourceProxy == resource)
{
Console.WriteLine("No proxy for {0}", resource);
}
else
{
Console.WriteLine("Proxy for {0} is {1}", resource.OriginalString,
resourceProxy.ToString());
}
}
설명
이 메서드는 GetProxy 인스턴스가 인터넷 리소스에 HttpClient 액세스하는 데 사용하는 URI를 반환합니다.
GetProxy 는 destination 메서드를 사용하여 의 BypassList내용과 비교됩니다 IsBypassed . 반환true되면 IsBypassed 반환 GetProxydestination 되고 인스턴스는 HttpClient 프록시 서버를 사용하지 않습니다.
없는 BypassList경우 destination 인스턴스는 HttpClient 프록시 서버를 사용하며 속성이 Address 반환됩니다.