using integrated NT security for an http post through a proxy serv

G

Guest

Hello,

We have a C#.NET app which runs as a windows service. Periodically it needs
to post information via the internet to a remote server.

For the posting, we are using HttpWebRequest class.

This service gets deployed to customer machines. In cases where they use a
proxy server, they complained that our service did not respect the proxy
settings they entered via Internet Explorer. In an earlier post to this
newsgroup, someone pointed out that the IE proxy settings are per user, and
that could be my problem. As it turned out, that was half the problem. We
not only had to run the service as the same user which had IE proxy settings,
but we also had to explicitly set the proxy settings of our HttpWebRequest to
those of IE, like this:

webRequest.Proxy = WebProxy.GetDefaultProxy();

That did work and it caused our service to begin using the IE proxy setting.

However, now the problem is authentication. Our web request is hitting the
proxy as an anonymous request, rather than using the integrated NT security
for the user under which it is running.

I can't find any documentation that tells me how to set my authentication to
use the integrated NT security. I did find sample code which shows how to
set the user/passwd of the proxy call to some strings, but that won't work in
cases where the proxy is trying to use integrated NT security.

Can anyone tell me how to achieve this?

thanks
Robb
 
K

Kevin Yu [MSFT]

Hi Robb,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to get the
credential of the current app and pass it to the Webproxy object. If there
is any misunderstanding, please feel free to let me know.

As far as I know, if you have run the windows service under a certain
account, you can get the credential using the
CredentialCache.DefaultCredentials property. Then you just assign it to the
Webproxy object's Credentials property like the following.

webRequest.Proxy.Credentials =
System.Net.CredentialCache.DefaultCredentials;

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

You're welcome, Robb.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top