WebRequest over SSL and Proxy

M

Matthias Kwiedor

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.Create(url);
try
{
WebProxy myProxy = new WebProxy();
myProxy = (WebProxy)WReq.Proxy;
WReq.Proxy = myProxy;
}
catch { }
WReq.CookieContainer = new CookieContainer();
HttpWebResponse WResp = (HttpWebResponse)WReq.GetResponse();
CookieCollection WCookies = WResp.Cookies;
StreamReader sr = new StreamReader(WResp.GetResponseStream(),
Encoding.GetEncoding(1252));
while ((strTemp = sr.ReadLine()) != null)
{
strHTTPGet = strHTTPGet + strTemp + "\n";
}
for (int i=0; i<WResp.Cookies.Count; i++)
{
Cookie myCookie = new Cookie(WResp.Cookies.Name.ToString(),
WResp.Cookies.Value.ToString(), "/", ".<domain>");
myCookieContainer.Add(myCookie);
}

Thanks for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top