自动登录网站 [英] Automatic login to website
本文介绍了自动登录网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
单击按钮后我想创建一个按钮用户可以通过存储在文本文件中的用户名和密码来自动登录某些网站,例如"Facebook".
我进行搜索并想出了这个简单的代码,但是它不起作用!
谁能解释这个问题!
I want to Create a button once i click it The user canlogin automatically login certain website like "Facebook" by stored user name and password in text file
I make search and came up with this simple code but it not work!!
can any one Explain the problem!!
<pre lang="c#">
private void button2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("http://www.facebook.com/");
int flag = 1;
while (flag == 1)
{
SendKeys.Send("Username.Txt");
SendKeys.Send("{TAB}");
SendKeys.Send("Password.Txt");
SendKeys.Send("{TAB}");
SendKeys.Send("{ENTER}");
flag = flag + 1;
}
}
谢谢U.
Thank U.
推荐答案
请不要这样,您或您的应用程序的用户将感谢您.
Facebook为这些操作提供了特殊的API:在此处 [
Please do not do it this way, you or the users of your application will thank you.
Facebook offers a special API for these actions: See here[^] for more info.
使用DOM.
use the DOM.
webbrowser.document.getelementbyid("usernameinputboxid").innerText =
textbox1.textl;
webbrowser.document.getelementbyid("passwordinputboxid").innerText = textbox2.textl;
webbrowser.document.getelementbyid("loginbuttonid").invokemember("click");
那么您可以创建一个xml文件,其中包含元素ID,要在其中添加哪些值,可通过单击按钮来自动完成整个操作.
还是要2美分
then you can create an xml file that maitains the element ids, what values to put in them, wich button to click and automate the whole thing.
my 2 cents anyway
尝试OneClickLogin工具(只需单击一下即可登录网站)
http://oneclicklogin.net [ ^ ]
Try OneClickLogin tool (Just one click to login the website)
http://oneclicklogin.net[^]
这篇关于自动登录网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文