By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,490 Members | 1,292 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,490 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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."

Nov 22 '05 #2

P: n/a
Thank you Kevin, that was what I needed, that worked great!

-Robb

"Kevin Yu [MSFT]" wrote:
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."

Nov 22 '05 #3

P: n/a
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."

Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.