首页 新闻 会员 周边

httpwebrequest自动登录后如何返回此登陆后的页面并保存状态?不是抓取页面

0
悬赏园豆:20 [已关闭问题]

我利用httpwebrequest自动登录某个站点后,返回的网页(例如loginsuccess.aspx)内容可以用response.write输出,但是,我现在要在http://www.###.com/loginsuccess.aspx上进行一些操作,而不是在http://localhost:80/loginsuccess.aspx上进行操作,怎么办?我试了在返回登录成功页面的html后,再response.redirect("http://www.###.com/loginsuccess.aspx")页面,但是cookie消失,请问如何操作。我不是要抓取页面,我是要在登陆成功后的页面进行操作。谢谢。。。。

问题补充: //进去后打开特定页面的参数设置 myRequest = (HttpWebRequest)WebRequest.Create(strurl); myRequest.Method = "GET"; myRequest.KeepAlive = false; myRequest.CookieContainer = Cc; //接收返回的特定页面 myResponse = (HttpWebResponse)myRequest.GetResponse(); 难道本地和远程的cookie不能共用?如何处理,尝试了用这个,仍然不行 //设置cookiecontain里的Domain System.Uri uri = new Uri(strurl); foreach (Cookie ck in myResponse.Cookies) { ck.Domain = uri.Host; } newStream = myResponse.GetResponseStream(); reader = new StreamReader(myResponse.GetResponseStream(), Encoding.Default); content = reader.ReadToEnd(); //Label1.Text = content; Response.Write(content+"<script>window.open(\""+strurl+"\", \"_blank\",\"menubar=0,scrollbar=0,resizable=0,channelmode=0,location=0,status=0\");</script>");//这里我本页面是可以的,但是window.open的一个新页面还要我重新登陆。 //Response.Redirect(strurl); Response.End(); } catch(Exception) { }
Showker的主页 Showker | 初学一级 | 园豆:135
提问于:2009-09-24 11:22
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册