在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);
本文转自linzheng 51CTO博客,原文链接:http://blog.51cto.com/linzheng/1078452