資源簡介
使用C#登錄帶驗證碼的網(wǎng)站
使用C#登錄帶驗證碼的網(wǎng)站
使用C#登錄帶驗證碼的網(wǎng)站
使用C#登錄帶驗證碼的網(wǎng)站
使用C#登錄帶驗證碼的網(wǎng)站
使用C#登錄帶驗證碼的網(wǎng)站

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
namespace?LoginSdoDemo
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
???????????if(string.IsNullOrEmpty(html))
???????????{
???????????????MessageBox.Show(“請點擊獲得驗證碼按鈕“);
???????????????return;
???????????}
????????????//string?lt?=?Getlt(html);
????????????//string?header?=?““;
????????????//string?url1?=?“https://cas.sdo.com:80/cas/login?service=http://zh.sdo.com/web1.0/home/select.asp“;
????????????//string?postData?=?“warn=false&_eventId=submit&idtype=0&gamearea=0&gametype=0&challenge=5652<=“?+?lt?+
????????????//??????????????????“&username=“?+?this.textBox1.Text?+?“&password=“?+?this.textBox2.Text?+
????????????//??????????????????“&ekey=&challenge=5652“;
????????????//html?=?Http.GetHtml(url1?postData?aspcookie?out?header);?//login
????????????//richTextBox1.AppendText(html);
????????????//if?(html.IndexOf(“l(fā)ogin2.asp“)?>?0)
????????????//{
????????????//????MessageBox.Show(“用戶名或密碼錯誤“);
????????????//????return;
????????????//}
????????????//html?=Http.GetHtml(“https://cas.sdo.com:80/cas/login?service=zh011x01.sdo.com/index.php“?aspcookie?out?header);
????????????//richTextBox1.AppendText(html);
????????????//if?(html.IndexOf(“l(fā)ogin2.asp“)?>?0)
????????????//{
????????????//????MessageBox.Show(“登錄失敗。請重試“);
????????????//????return;
????????????//}
????????????string?clientKey?=?GetClientKey(html);
????????????string?postData?=
????????????????“__EVENTTARGET=&__EVENTARGUMENT=&__VIEWSTATE=%2FwEPDwULLTE4NDgzMDI2NjcPFgIeCkZpbmlzaFN0YXloFgJmD2QWBAIBDxYCHgRUZXh0BQznlKjmiLfnmbvlvZVkAgIPZBYCAgMPZBYCAgEPFgIeB1Zpc2libGVoZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18WAgUeY3RsMDAkQ1BIX0NvbnRlbnQkY2JfU2F2ZVN0YXRlBR1jdGwwMCRDUEhfQ29udGVudCRJbWFnZV9Mb2dpbr5SL%2FGtMqVCJ%2FCh4jH%2FXp4DhlVU&ctl00%24CPH_Content%24tb_LoginNameOrLoginEmail=“+textBox1.Text
????????????????+“&ctl00%24CPH_Content%24tb_Password=“+textBox2.Text
????????????+“&ctl00%24CPH_Content%24tb_ExPwd=“+textBox3.Text
????????????+“&ClientKey=“+clientKey
????????????+“&ctl00%24CPH_Content%24cb_SaveState=on&from=http%3A%2F%2Fhi.csdn.net%2Fmy.html&MailParameters=&MailParameters=&ctl00%24CPH_Content%24Image_Login.x=26&ctl00%24CPH_Content%24Image_Login.y=11“;
????????????string?header;
????????????string?returnHtml?=?Http.GetHtml(“http://passport.csdn.net/UserLogin.aspx“?postData?aspcookie?out?header);?//login
????????????richTextBox1.AppendText(returnHtml);
????????????//if?(html.IndexOf(“l(fā)ogin2.asp“)?>?0)
????????????//{
????????????//????MessageBox.Show(“用戶名或密碼錯誤“);
????????????//????return;
????????????//}
????????}
????????private?string?GetClientKey(string?html)
????????{
????????????string?str?=?html.
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????28672??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\bin\Debug\LoginSdoDemo.exe
?????文件??????34304??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\bin\Debug\LoginSdoDemo.pdb
?????文件???????5632??2008-05-08?01:55??LoginSdoDemo\LoginSdoDemo\bin\Debug\LoginSdoDemo.vshost.exe
?????文件???????4251??2008-05-08?02:11??LoginSdoDemo\LoginSdoDemo\Form1.cs
?????文件???????7172??2008-05-08?02:11??LoginSdoDemo\LoginSdoDemo\Form1.Designer.cs
?????文件???????5814??2008-05-08?02:11??LoginSdoDemo\LoginSdoDemo\Form1.resx
?????文件???????6105??2008-05-08?01:10??LoginSdoDemo\LoginSdoDemo\Http.cs
?????文件???????3266??2008-05-06?02:09??LoginSdoDemo\LoginSdoDemo\LoginSdoDemo.csproj
?????文件????????842??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\obj\Debug\LoginSdoDemo.csproj.GenerateResource.Cache
?????文件??????28672??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\obj\Debug\LoginSdoDemo.exe
?????文件????????180??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\obj\Debug\LoginSdoDemo.Form1.resources
?????文件??????34304??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\obj\Debug\LoginSdoDemo.pdb
?????文件????????180??2008-05-06?02:09??LoginSdoDemo\LoginSdoDemo\obj\Debug\LoginSdoDemo.Properties.Resources.resources
?????文件????????807??2008-05-08?02:12??LoginSdoDemo\LoginSdoDemo\obj\LoginSdoDemo.csproj.FileListAbsolute.txt
?????文件????????479??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Program.cs
?????文件???????1280??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Properties\AssemblyInfo.cs
?????文件???????2853??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Properties\Resources.Designer.cs
?????文件???????5350??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Properties\Resources.resx
?????文件???????1097??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Properties\Settings.Designer.cs
?????文件????????249??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo\Properties\Settings.settings
?????文件????????260??2008-05-08?02:13??LoginSdoDemo\LoginSdoDemo.gpState
?????文件????????902??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo.resharper
?????文件???????1045??2008-05-08?02:13??LoginSdoDemo\LoginSdoDemo.resharper.user
?????文件????????925??2008-05-06?01:16??LoginSdoDemo\LoginSdoDemo.sln
????..A..H.?????15360??2008-05-08?02:13??LoginSdoDemo\LoginSdoDemo.suo
?????文件???????3288??2008-05-08?01:55??LoginSdoDemo\_ReSharper.LoginSdoDemo\CachesImage.bin
?????文件??????????4??2008-05-08?01:55??LoginSdoDemo\_ReSharper.LoginSdoDemo\TodoCache\.format
?????文件???????1084??2008-05-08?01:55??LoginSdoDemo\_ReSharper.LoginSdoDemo\TodoCache\3\57389b87.dat
?????文件??????????4??2008-05-08?01:55??LoginSdoDemo\_ReSharper.LoginSdoDemo\WordIndex.New\.format
?????文件???????4695??2008-05-08?01:55??LoginSdoDemo\_ReSharper.LoginSdoDemo\WordIndex.New\6\37a09c11.dat
............此處省略16個文件信息
評論
共有 條評論