C# code to Check IE Proxy Settings

private static void CheckIEProxySettings()
{
    string strFileURL = "http://programmersvision.blogspot.in";
    HttpWebRequest WebReqt = (HttpWebRequest)HttpWebRequest.Create(strFileURL);
    WebProxy WP = new WebProxy(WebReqt.Proxy.GetProxy(new Uri(strFileURL)));
    WP.Credentials = CredentialCache.DefaultCredentials;
    Console.WriteLine(WP.Address);
    // or use this method
    //CheckForProxy(new Uri("http://http://programmersvision.blogspot.in"));
}

private static void CheckForProxy(Uri resource)
{
    WebProxy proxy = (WebProxy)WebProxy.GetDefaultProxy();
    Uri proxyUri = proxy.GetProxy(resource);
    if (proxyUri == resource)
    {
        Console.WriteLine("There is no proxy for {0}", resource);
    }
    else
    {
        Console.WriteLine("Proxy for {0} is {1}", resource, proxyUri.ToString());
    }
}

Comments

  1. WOW!! terribly informative web log and helpful techniques. Please visit this web site if you wish a lot of detail.
    access BitSnoop in UK

    ReplyDelete
  2. very nice and helpfull article.The translation service is really very helpful to me.
    access FileCrop in UK

    ReplyDelete

Post a Comment

Popular posts from this blog

Convert XElement to DataTable

Enable mouse scroll-wheel in VB6