日期:2014-05-20 浏览次数:20979 次
]
WebRequestObject = (HttpWebRequest) WebRequest.Create( "http://www.webdiyer.com/cookietest.aspx ");
WebRequestObject.Method = "GET ";
System.Net.CookieContainer CookieContainerObject = new System.Net.CookieContainer();
System.Net.Cookie Cookie = new System.Net.Cookie();
Cookie.Name = "userid ";
Cookie.Value = "1234567890 ";
Cookie.Domain = Request.ServerVariables[ "HTTP_HOST "];
Cookie.Secure = true;
CookieContainerObject.Add(Cookie);
WebRequestObject.CookieContainer = CookieContainerObject;
WebResponseObject = (HttpWebResponse) WebRequestObject.GetResponse();
sr = new StreamReader(WebResponseObject.GetResponseStream());
String Results = sr.ReadToEnd();