Fórmulas e Cenas

Object Reference Not Set to Instance of an Object

  Home  |   Contact  |   Syndication    |   Login
  40 Posts | 0 Stories | 7 Comments | 0 Trackbacks

News

Archives

Post Categories

Links



After several days of banging my head against a wall, it was time to finally smile :)

When invoking a web page in an activeX component if the client needs a proxy server to access the web, then you have a problem, a not so well documented problem...

So if you ever are in this position, just use this function ;)

private static WebProxy QueryIEProxySettings(string strFileURL)
{
     HttpWebRequest WebReqt = (HttpWebRequest)HttpWebRequest.Create(strFileURL);

     WebProxy WP = new WebProxy(WebReqt.Proxy.GetProxy(new Uri(strFileURL)));
     WP.Credentials = CredentialCache.DefaultCredentials;

     return WP;
}

Enjoy :)
posted on Tuesday, January 20, 2009 5:16 PM