本文整理匯總了C#中System.Net.WebProxy.GetProxy方法的典型用法代碼示例。如果您正苦於以下問題:C# WebProxy.GetProxy方法的具體用法?C# WebProxy.GetProxy怎麽用?C# WebProxy.GetProxy使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Net.WebProxy
的用法示例。
在下文中一共展示了WebProxy.GetProxy方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CheckAutoGlobalProxyForRequest
// 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());
}
}