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!
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!
Comment