Cookie = "cookie"
//与 cookie集合不能同时使用
CookieCollection=cookie
南方 发表于 2014-8-23 20:08
[mw_shl_code=csharp,true]Cookie = "cookie"
//与 cookie集合不能同时使用
CookieCollection=cooki ...
/// <summary>
/// 设置Cookie
/// </summary>
/// <param name="item">Http参数</param>
private void SetCookie(HttpItem item)
{
if (!string.IsNullOrEmpty(item.Cookie)) request.Headers[HttpRequestHeader.Cookie] = item.Cookie;
//设置CookieCollection
if (item.ResultCookieType == ResultCookieType.CookieCollection)
{
request.CookieContainer = new CookieContainer();
if (item.CookieCollection != null && item.CookieCollection.Count > 0)
request.CookieContainer.Add(item.CookieCollection);
}
}
站长苏飞 发表于 2014-8-23 23:17
[mw_shl_code=csharp,true] ///
/// 设置Cookie
///
欢迎光临 苏飞论坛 (http://www.sufeinet.com/) | Powered by Discuz! X3.4 |