Windows Phone 7 Http请求添加Cookie的方法
在wp7上添加Cookie请求头可以使用下面的方法:
HttpWebRequest request = System.Net.HttpWebRequest.Create("https://myurl.com") as HttpWebRequest
request.Headers["Cookie"] = "CookieName=CookieValue";
在wp7上使用下面的方法来添加Cookie请求头是不成功的:
HttpWebRequest request = System.Net.HttpWebRequest.Create("https://myurl.com") as HttpWebRequest
Cookie c = new Cookie("MyCookieName", myToken, "[valid path]", "[valid domain]");
request.CookieContainer = new CookieContainer();
request.CookieContainer.Add(new Uri("http://myurl.com"), c);