RE: httpwebrequest with https behind proxy with authentication
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Fri, 07 Dec 2007 03:56:24 GMT
Hi Andrea,
From your description, you're using WebRequest component to download a filefrom a remote webservice. That webservice is accessed through a proxy and
the proxy also require authentication. However, you found your webservice
client always get proxy authentication error, correct?
Based on the code snippet you provided, you directly create a
NetworkCredential (with username/password pair) and send it via
WebProxy.Credentials. One potential things here is that whether you've
confirmed what kind of Authentication Type is the webproxy using?
Integrated windows or basic or ...?
Generally, when sending credential through NetworkCredential, it is
recommended that you explicitly supply the authenticationType(via
CredentialCache class). e.g.
=========
CredentialCache cache = new CredentialCache();
cache.Add( new Uri(proxy.Url),
// Web service URL
"Negotiate",
// Kerberos or NTLM
new NetworkCredential("username", "password", "domainname")
);
proxy.Credentials = cache;
=========
the following thread has also mentioned this:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1772251&SiteID=1
You can try looking at this to see whether this is the cause.
BTW, also check the behavior when you visit it in IE(whether there is any
warning or error you interactively ignore), since any interactively
ignorable error will cause exception in programamtic code.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Andrea Pierini" <andrea_maticad@xxxxxxxxxxxxx>
Subject: httpwebrequest with https behind proxy with authentication
Date: Thu, 6 Dec 2007 16:26:19 +0100
Hi to all,
I have a problem to download a file with httpwebrequest when
_ https protocol is used
_ the client is behind a proxy that requires authentication
For example consider the following code:
WebRequest req =
WebRequest.Create("https://www.domus3d.com/ws/test.txt");
req.Proxy = new WebProxy("http://192.168.0.6:3128", true); //
Proxy available at IP 192.168.0.6 on port 3128
req.Proxy.Credentials = new NetworkCredential("user", "pwd",
"domain"); // Proxy network credentials
WebResponse res = req.GetResponse();
I always receive "The remote server returned an error: (407) Proxy
Authentication Required.". What's wrong? Note that if I make the request
over http the code works and with Internet Explorer I can open the file
either over http or over https.
Thanks in advance for any help,
Andrea Pierini
PS: I've seen that many users experience the same problem with WSUS 3.0
behind a proxy with authentication
.
- Follow-Ups:
- Re: httpwebrequest with https behind proxy with authentication
- From: Andrea Pierini
- Re: httpwebrequest with https behind proxy with authentication
- References:
- httpwebrequest with https behind proxy with authentication
- From: Andrea Pierini
- httpwebrequest with https behind proxy with authentication
- Prev by Date: Re: Custom Attribute and Instance Sample?
- Next by Date: Re: httpwebrequest with https behind proxy with authentication
- Previous by thread: httpwebrequest with https behind proxy with authentication
- Next by thread: Re: httpwebrequest with https behind proxy with authentication
- Index(es):
Relevant Pages
|