C# httpRequest.CookieContainer 获取cookies的问题
Set-Cookie:dipan_tag=7aARB3EwStI=;domain=dipan.com;path=/Set-Cookie:login_name=53a51a...
Set-Cookie: dipan_tag=7aARB3EwStI=; domain=dipan.com; path=/
Set-Cookie: login_name=53a51a54a49a55a48a120; domain=dipan.com; path=/
Set-Cookie: cid=92212; path=/
Set-Cookie: tid=0; path=/
Set-Cookie: timeout={list:[]}; path=/
Set-Cookie: uid=69725; path=/
Set-Cookie: today=1; path=/
Set-Cookie: sg_cur_uid_1=69725; domain=sg7.dipan.com; expires=Sun, 07-Feb-2010 17:45:25 GMT; path=/
为什么除了最后一条以上的全部可以获取?
是domain的问题吗?应该如何解决?
我是连接一个网页游戏的程序,抓包分析下来除了setcookies sg_curxxxx domain=sg7.xxxx这个之外其余的都能够储存进来。
我是用WebClient类重载
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
request.PreAuthenticate = true;
if (request is HttpWebRequest)
{
HttpWebRequest httpRequest = request as HttpWebRequest;
httpRequest.AllowAutoRedirect = false ;
httpRequest.CookieContainer = cookieContainer;
}
return request;
}
实现获取cookie的,那么sg7.xxx的cookies应该如何获取
//MyCookies.SetCookies(new Uri("http ://g7.dipan.com"), "sg_cur_uid_1=69725");
上面这行如果去掉注释就能够成功登陆游戏,而这个cookies无法通过WebClient自动获取,其余的dipan.com的cookies都可以正常获取 展开
Set-Cookie: login_name=53a51a54a49a55a48a120; domain=dipan.com; path=/
Set-Cookie: cid=92212; path=/
Set-Cookie: tid=0; path=/
Set-Cookie: timeout={list:[]}; path=/
Set-Cookie: uid=69725; path=/
Set-Cookie: today=1; path=/
Set-Cookie: sg_cur_uid_1=69725; domain=sg7.dipan.com; expires=Sun, 07-Feb-2010 17:45:25 GMT; path=/
为什么除了最后一条以上的全部可以获取?
是domain的问题吗?应该如何解决?
我是连接一个网页游戏的程序,抓包分析下来除了setcookies sg_curxxxx domain=sg7.xxxx这个之外其余的都能够储存进来。
我是用WebClient类重载
protected override WebRequest GetWebRequest(Uri address)
{
WebRequest request = base.GetWebRequest(address);
request.PreAuthenticate = true;
if (request is HttpWebRequest)
{
HttpWebRequest httpRequest = request as HttpWebRequest;
httpRequest.AllowAutoRedirect = false ;
httpRequest.CookieContainer = cookieContainer;
}
return request;
}
实现获取cookie的,那么sg7.xxx的cookies应该如何获取
//MyCookies.SetCookies(new Uri("http ://g7.dipan.com"), "sg_cur_uid_1=69725");
上面这行如果去掉注释就能够成功登陆游戏,而这个cookies无法通过WebClient自动获取,其余的dipan.com的cookies都可以正常获取 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询