Proxy Settings for Web Service

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a .Net application interoperating with an MFC application. We are
using .NET framework 1.1. In the .NET app, I am using a Web Service for my
Database operations. I am having problem accessing the Web Server for clients
who use proxy server. The error message they get is "The underlying
connection is closed....". The MFC application seems to be working fine.

To handle this case, I provided a dialog and asked the client to enter the
the Proxy Server name, proxy port and any credentials that require for them
to login to the Proxy server. Using this information I created a new WebProxy
object and
assigned it to the WebSvc.Proxy

For those who knew the name of the Proxy server, this solution worked. But
some people who use the setting "Use automatic configuration script" are
having problems. According to msdn documentation the method GetDefaultProxy
does not return dynamic settings. My questions are

1. Is there any other way to get the proxy information through any other
..NET method. for those who are configured using "Use automatic configuration
script".

2. I tried using WinHTTP library method, WinHttpGetProxyForURL, by passing
the pac file location. But I seem to have one problem, if I pass the pac file
location to WinHttpGetProxyForURL as "http:\\localhost\Proxy\proxy.pac", it
seems to work fine. But if I configure my proxy.pac as the default document
for the virtual directory folder Proxy and then pass the URL as only
http:\\localhost\Proxy without the pac file, the call fails returning "File
not found". But if I specify the same in IE, it seems to work properly.
The client uses a setting similar to this. They do not know the pac file
name. Their IE configuration is http:\\server:8081. This server is not a
proxy server. Am I doing anything wrong or is there any other way to obtain
the proxy server name.

3. Somehow, the MFC application works through all the configuration. We are
using CInternetSession and CHttpConnection classes to connect to the web. I
also tried using QueryOption for CInternetSession object to get the Proxy
Server Name and Port. But again this returns only the static settings. Is it
possible to get the dynamic settings information through any of these
objects, so that I can pass the information to the .NET application and
create a corresponding WebProxy method.

Thanks,
Mani
 
Back
Top