Re: httpwebrequest with https behind proxy with authentication
- From: stcheng@xxxxxxxxxxxxxxxxxxxx (Steven Cheng[MSFT])
- Date: Wed, 12 Dec 2007 03:20:34 GMT
Hi Andrea,
Thanks for your followup. I've read the kb article, and I agree that the
issue it describes seems quite fit your scenario. As the article mentioned,
for such hotfix, you'll need to contact CSS to confirm whether your problem
match the hotfix condition and if necessary you can obtain the hotfix from
them:
===========
To resolve this problem immediately, contact Microsoft Customer Support
Services to obtain the hotfix. For a complete list of Microsoft Customer
Support Services telephone numbers and information about support costs,
visit the following Microsoft Web site:
http://support.microsoft.com/contactus/?ws=support
==============
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: "Andrea Pierini" <andrea_maticad@xxxxxxxxxxxxx><0dEVtUIOIHA.7908@xxxxxxxxxxxxxxxxxxxxxx>
References: <E7967F89-31FB-468A-8B0F-05BD3B770C04@xxxxxxxxxxxxx>
<A83DD1A4-8C6C-4653-AF56-31D5F6C027CE@xxxxxxxxxxxxx>
In-Reply-To: <A83DD1A4-8C6C-4653-AF56-31D5F6C027CE@xxxxxxxxxxxxx>hotfixes
Subject: Re: httpwebrequest with https behind proxy with authentication
Date: Mon, 10 Dec 2007 09:24:00 +0100
Hi to all,
after searching and searching perhaps I have found the problem, it is
documented in Microsoft KB928563. Can anyone who has access to the
confirm this?modified
Regards,
Andrea Pierini
"Andrea Pierini" <andrea_maticad@xxxxxxxxxxxxx> wrote in message
news:A83DD1A4-8C6C-4653-AF56-31D5F6C027CE@xxxxxxxxxxxxxxxx
Hi Steven,
first of all thanks for your answer.
Our proxy server uses NTLM authentication and as you suggested I
WebRequest.Create("https://www.domus3d.com/ws/test.txt");the code as follows:
*******************************
WebRequest req =
tests,Uri proxyuri = new Uri("http://192.168.0.6:3128");
WebProxy proxy = new WebProxy(proxyuri, true);
NetworkCredential cred = new NetworkCredential("administrator", "xxxxx",
"WEBSERVER12");
CredentialCache credcache = new CredentialCache();
credcache.Add(proxyuri, "NTLM", cred);
proxy.UseDefaultCredentials = false;
proxy.Credentials = credcache;
req.Proxy = proxy;
WebResponse res = req.GetResponse();
*******************************
I still receive "The remote server returned an error: (407) Proxy
Authentication Required." and it works if I use http instead of https or
if I disable authentication on the proxy (I can do it to make some
linebut our customers can't). This is the proxy server log:
*******************************
1197019352.005 0 192.168.0.250 TCP_DENIED/407 2108 CONNECT
www.domus3d.com:443 - NONE/- text/html
1197019425.021 73000 192.168.0.250 TCP_MISS/200 3322 CONNECT
www.domus3d.com:443 webserver12\administrator DIRECT/62.149.195.31 -
1197019632.552 0 192.168.0.250 TCP_DENIED/407 1839 GET
http://www.domus3d.com/ws/test.txt - NONE/- text/html
1197019632.568 0 192.168.0.250 TCP_DENIED/407 2153 GET
http://www.domus3d.com/ws/test.txt - NONE/- text/html
1197019632.599 31 192.168.0.250 TCP_HIT/200 464 GET
http://www.domus3d.com/ws/test.txt webserver12\administrator NONE/-
application/octet-stream
1197021220.771 39422 192.168.0.250 TCP_MISS/200 3466 CONNECT
www.domus3d.com:443 webserver12\administrator DIRECT/62.149.195.31 -
*******************************
Line #1 is the .Net code trying to access the file over https (doesn't
work); line #2 is FireFox successfully accessing the file over https;
#6#3/4/5 is the .Net code successfully accessing the file over http; line
seemsis Internet Explorer successfully accessing the file over https. It
andthat the .Net code doesn't pass the proxy authentication over HTTP
CONNECT.
Any idea?
Thanks in advance,
Andrea Pierini
"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:0dEVtUIOIHA.7908@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi Andrea,
From your description, you're using WebRequest component to download a
file
from a remote webservice. That webservice is accessed through a proxy
webservicethe proxy also require authentication. However, you found your
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notifclient 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
theications.
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
situationsmost efficient resolution. The offering is not appropriate for
bestthat require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are
contactinghandled working with a dedicated Microsoft Support Engineer by
//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
.
- References:
- httpwebrequest with https behind proxy with authentication
- From: Andrea Pierini
- RE: httpwebrequest with https behind proxy with authentication
- From: Steven Cheng[MSFT]
- Re: httpwebrequest with https behind proxy with authentication
- From: Andrea Pierini
- Re: httpwebrequest with https behind proxy with authentication
- From: Andrea Pierini
- httpwebrequest with https behind proxy with authentication
- Prev by Date: Re: Help running a .NET 2005 executable on a network share? Trying to use ClickOnce
- Next by Date: Re: .NET Runtime 2.0 Error
- Previous by thread: Re: httpwebrequest with https behind proxy with authentication
- Next by thread: Custom Attribute and Instance Sample?
- Index(es):
Relevant Pages
|