I get a nullreference exception at the cookiecontainer.add(OC);
I dont know what i was doing wrong, as i was following an example from: Sending cookies using HttpCookieCollection and CookieContainer and I more or less was following it perfectly. The error occurs for both INDEX and KEY referencing to the cookie.
System.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(URI);
request.KeepAlive = true;
HttpCookieCollection cookieJar = Request.Cookies;
//foreach (string cookieString in Request.Cookies)
for(int i = 0; i < cookieJar.Count; i++)
{
System.Web.HttpCookie cookie = cookieJar.Get(i);
Cookie oC = new Cookie();
oC.Domain = Request.Url.Host;
oC.Expires = cookie.Expires;
oC.Name = cookie.Name;
oC.Path = cookie.Path;
oC.Secure = cookie.Secure;
oC.Value = cookie.Value;
request.CookieContainer.Add(oC);
}