文件名称:2009_4_CookieManager
- 所属分类:
- Internet/网络编程
- 资源属性:
- [Windows] [Visual.Net] [Basic/ASP] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 14kb
- 下载次数:
- 0次
- 提 供 者:
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
CookieManager 提供 CookieHandler 的具体实现,它将 cookie 的存储区与围绕接受和拒绝 cookie 的策略分离开来。使用管理存储的 CookieStore 以及做出 cookie 接受/拒绝决策的 CookiePolicy 对象来初始化 CookieManager。 -/********************************************************************************//**
A typical usage of this class would look something like this:
CookieManager cookieManager = new CookieManager()
// Set a cookie value
cookieManager.CookieValues["FavoriteCookie"] = "Chocolate Chip"
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url)
// Publish the cookies to the request before asking for the response
cookieManager.PublishCookies(webRequest)
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()
// Store any cookies returned from the response
cookieManager.StoreCookies(webResponse)
// Get the value of a cookie
string session = cookieManager.CookieValues["SESSIONID"]
webRequest = (HttpWebRequest)WebRequest.Create(url2)
cookieManager.PublishCookies(webRequest)
webResponse = (HttpWebResponse)webRequest.GetResponse()
************************************************************************************/
A typical usage of this class would look something like this:
CookieManager cookieManager = new CookieManager()
// Set a cookie value
cookieManager.CookieValues["FavoriteCookie"] = "Chocolate Chip"
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url)
// Publish the cookies to the request before asking for the response
cookieManager.PublishCookies(webRequest)
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()
// Store any cookies returned from the response
cookieManager.StoreCookies(webResponse)
// Get the value of a cookie
string session = cookieManager.CookieValues["SESSIONID"]
webRequest = (HttpWebRequest)WebRequest.Create(url2)
cookieManager.PublishCookies(webRequest)
webResponse = (HttpWebResponse)webRequest.GetResponse()
************************************************************************************/
(系统自动生成,下载前可以参看下载内容)
下载文件列表
2009_4_CookieManager.cs