WebRequest over SSL and Proxy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matthias Kwiedor

    WebRequest over SSL and Proxy

    I try to get a page from a https server. I can build up a connection
    with WebRequest and everything runs fine without setting a proxy.

    After setting a proxy, i get the error that i can't build a thrusted
    connection to the remote server. If i try it over the IE i get a pop up
    which tells me the same, but i can override it!

    Anyone has i idea? i need that in combination with a cookiecontainer !

    Code:

    HttpWebRequest WReq = (HttpWebRequest )WebRequest.Cre ate(url);
    try
    {
    WebProxy myProxy = new WebProxy();
    myProxy = (WebProxy)WReq. Proxy;
    WReq.Proxy = myProxy;
    }
    catch { }
    WReq.CookieCont ainer = new CookieContainer ();
    HttpWebResponse WResp = (HttpWebRespons e)WReq.GetRespo nse();
    CookieCollectio n WCookies = WResp.Cookies;
    StreamReader sr = new StreamReader(WR esp.GetResponse Stream(),
    Encoding.GetEnc oding(1252));
    while ((strTemp = sr.ReadLine()) != null)
    {
    strHTTPGet = strHTTPGet + strTemp + "\n";
    }
    for (int i=0; i<WResp.Cookies .Count; i++)
    {
    Cookie myCookie = new Cookie(WResp.Co okies[i].Name.ToString( ),
    WResp.Cookies[i].Value.ToString (), "/", ".<domain>" );
    myCookieContain er.Add(myCookie );
    }

    Thanks for your help!
  • Horatiu Ripa

    #2
    Re: WebRequest over SSL and Proxy

    You have to obtain a certificate from the server via IE first. Check this
    out:
    http://www.microsoft.com/windows2000...roughs/default.
    asp#section7

    --
    Horatiu Ripa

    "Matthias Kwiedor" <crazyivan9@hot mail.com> wrote in message
    news:Xns9431856 06FE3Ecrazyivan 9hotmailcom@207 .46.248.16...[color=blue]
    > I try to get a page from a https server. I can build up a connection
    > with WebRequest and everything runs fine without setting a proxy.
    >
    > After setting a proxy, i get the error that i can't build a thrusted
    > connection to the remote server. If i try it over the IE i get a pop up
    > which tells me the same, but i can override it!
    >
    > Anyone has i idea? i need that in combination with a cookiecontainer !
    >
    > Code:
    >
    > HttpWebRequest WReq = (HttpWebRequest )WebRequest.Cre ate(url);
    > try
    > {
    > WebProxy myProxy = new WebProxy();
    > myProxy = (WebProxy)WReq. Proxy;
    > WReq.Proxy = myProxy;
    > }
    > catch { }
    > WReq.CookieCont ainer = new CookieContainer ();
    > HttpWebResponse WResp = (HttpWebRespons e)WReq.GetRespo nse();
    > CookieCollectio n WCookies = WResp.Cookies;
    > StreamReader sr = new StreamReader(WR esp.GetResponse Stream(),
    > Encoding.GetEnc oding(1252));
    > while ((strTemp = sr.ReadLine()) != null)
    > {
    > strHTTPGet = strHTTPGet + strTemp + "\n";
    > }
    > for (int i=0; i<WResp.Cookies .Count; i++)
    > {
    > Cookie myCookie = new Cookie(WResp.Co okies[i].Name.ToString( ),
    > WResp.Cookies[i].Value.ToString (), "/", ".<domain>" );
    > myCookieContain er.Add(myCookie );
    > }
    >
    > Thanks for your help![/color]


    Comment

    Working...