Re: HTTP Network Programming Issue



If I unerstand you correctly, you are saying that you cannot get to a site
which requires Cookie, Authentication and SSL at the same time, while going
through a proxy that also requires authentication.

If so, looking at your code below, I dont see you adding credential to the
HttpWebRequest object. You should set credentials on the HttpWebRequest as
well, otherwise your credentials wont be sent, and hence the request will
get denied with a 401.

--
feroze

-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.

See http://weblogs.asp.net/feroze_daud for System.Net related posts.
----------------

"bd-chan" <brentdsmith@xxxxxxxxx> wrote in message
news:1116520425.801933.64120@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I'm trying to log in to a secured web site automatically using c#. To
> do this I have go through a proxy server, and use SSL, and log in to
> the secure site with another user name and password (different from the
> proxy user name and password).
>
> Now, I can get through the proxy by setting the correct credentials on
> the WebProxy. I can get through SSL by setting up a dummy certificate
> policy class that always returns true. If I go to a regular web site
> like http:\\www.google.com it works. If I go to SSL site
> (https:\\siteusingssl.com\) then it works. The problem occurs when
> trying to access the site that requires all three methods. The error
> returned is 401: Unauthorized. I think the site may use cookies, but I
> can't check the cookies returned in the response object because when I
> do the request.GetResponse() it always throws an exception and doesn't
> return a valid response object.
>
> If you've read this much, then you deserve to see the code of my most
> recent attempt:
>
> //Set Up The Proxy Server
> WebProxy proxy = new WebProxy("http://my.proxy.com:3128/";, true);
> CredentialCache proxyCache = new CredentialCache() ;
> proxyCache.Add(new Uri("http://my.proxy.com:3128/";), "Basic", new
> NetworkCredential("user", "pw")) ;
> proxyCache.Add(new Uri("https://the.secured.com/";), "Basic", new
> NetworkCredential("user", "pw")) ;
>
> proxy.Credentials = proxyCache ;
> request = WebRequest.Create("https://the.secured.com";) ;
> request.Proxy = proxy;
>
> //Set Up SSL
> ServicePointManager.CertificatePolicy = new CertPolicy();
>
> // Send the 'HttpWebRequest' and wait for response.
> HttpWebResponse response = (HttpWebResponse)request.GetResponse();
>
> Any help will be much appreciated.
>
> Thanks,
>
> Brent
>


.



Relevant Pages

  • RE: [fw-wiz] NTLM authentication from DMZ
    ... and a simple reverse proxy that can also act as SSL ... Unless you're handing out client-side certs (and we've had the SSL ... authentication is going to be username/password for your user's accounts. ... not only of the user's e-mail, but of their credentials. ...
    (Firewall-Wizards)
  • Re: ADAM and Windows Address Book
    ... checking SPA if they aren't going to use them. ... SSPI logon using the credentials of the logged on account. ... ADAM user. ... Checking SSL results in an LDAP simple bind over SSL. ...
    (microsoft.public.windows.server.active_directory)
  • Re: ISA 2004 Server Errors
    ... Tunneling SSL Through a WWW Proxy ... CONNECT is really a lower-level function than the rest of the HTTP methods, ... Through ISA Server ...
    (microsoft.public.isa)
  • Re: Preventing tunnels through HTTPS proxies
    ... Alternatively playing a man-in-the-middle on the proxy, ... but also the matter of the stuff in SSL certificate matching the ... look up the SSL handshake procedure) you were able to distinguish SSL ... How can you tell HTTP traffic over SSL connection from any other ...
    (Security-Basics)
  • Re: ecommerce / ssl over 3g ?
    ... Yes, they could - but as I said, it depends on how they have their proxy set ... IIRC, as SSL is initiated, the client requests a key from the site. ... > If you have an SSL certificate that identifies itself as "mysite.com" ...
    (uk.telecom.mobile)