使用asp.net自动登录网站 [英] Automatically login website using asp.net

查看:131
本文介绍了使用asp.net自动登录网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的Web应用程序中包含的Url列表中还具有带有控件名称的Url登录详细信息.当我单击列表中的网址"时,我想在新标签页中打开网址,也会自动登录.


请帮助我...

In my web application contains the list of Url also have the Url login details information with control name. when i click the Url in the list i want to open the url in new tab also login automatically.


please help me...

推荐答案


当我单击列表中的Url时,我想在新标签页中打开url也会自动登录.
如果是表单验证,请通过用户名&密码作为URL中的查询字符串.

然后,您需要在页面加载中完成的所有操作如下:
when i click the Url in the list i want to open the url in new tab also login automatically.
If it''s a Forms Authentication, pass the username & password as querystring in the URL.

Then, all you need to do in your page load is something like:
string username = Request.QueryString["username"].ToString();
   string password = Request.QueryString["password"].ToString();
   if (Membership.ValidateUser(username , password))
   {
         FormsAuthentication.SetAuthCookie(username , true);
         Response.Redirect("~/");
   }



其他方法可能是使用HttpWebReqest和HttpWebResponse,在使用后面的代码进行爬网时传递页面的适当参数.
请参阅以下示例:
VBASPNETAutoLogin概述 [ ^ ]
HttpWebRequest发布方法 [



Other way could be to use HttpWebReqest and HttpWebResponse, pass appropriate parameters of the page while crawling using code behind.
See these samples:
VBASPNETAutoLogin Overview[^]
HttpWebRequest Post method[^]


这篇关于使用asp.net自动登录网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆