0

Writing a little C# console app (.Net 4.5) that uses the MSXML2.ServerXMLHTTP object to open a connection to a site and pull down a file. It works fine from home, but does not work from within our network here at work.

I have a VB6 app and a WSF (windows script host) app that do something almost identical and work fine from within our network. But when I try this little C# app it errors with message : a connection with the server could not be established. I have all of the correct references since it works fine from outside our network.

Any ideas on what could be preventing the connection from the C# .net app?

    MSXML2.ServerXMLHTTP x = new MSXML2.ServerXMLHTTP();
    x.setOption(SERVERXMLHTTP_OPTION.SXH_OPTION_IGNORE_SERVER_SSL_CERT_ERROR_FLAGS,13056);
    x.open("GET", @"http://www.fededirectory.frb.org/updatesForACH.cfm?sinceDate=03/01/2014", false, null, null); 
    x.send();
    Console.WriteLine(x.responseText);
rene
  • 41,474
  • 78
  • 114
  • 152
user360943
  • 109
  • 2
  • 9
  • 1
    is www.fededirectory.frb.org reachable from within the network? Network enigneers generally don't like internal clients to connect to the servers on the outside NIC so that 9 out of 10 blocked. You can check with a `tracert www.fededirectory.frb.org` where you're stuck and then contact your networknengineers. – rene Apr 22 '14 at 19:07
  • Absolutely it is - I can put that url in my browser and it returns the expected results. I can execute somthing similar in VB6 or WSF and it returns the expected results. Just not from C# .Net 4.5 running in visual studio 2012, t cannot establish a connection for some reason. – user360943 Apr 22 '14 at 19:20
  • Is that .net app compiled as x86? And why do you use MSXML2 and not the System.Net.WebClient? Are you using a proxy? – rene Apr 22 '14 at 19:25
  • I've tried x86 and any CPU, makes no difference. I've tried the System.Net.HttpWebRequest and System.Net.HttpWebResponse objects and gotten something like : The Remote server returned an error:(407) Proxy Authentication Required - this was never an issue in the past with the VB6 or wsf code... – user360943 Apr 22 '14 at 19:31
  • Have a look here http://stackoverflow.com/questions/9603093/407-proxy-authentication-required-in-c-sharp – rene Apr 22 '14 at 19:42
  • Ok - thanks! Adding that entry to the app.config and then using the web proxy worked as in that post worked fine - thanks! – user360943 Apr 22 '14 at 21:07

0 Answers0