日期:2014-05-18  浏览次数:20884 次

200分求个小实例,怎么自动登录网站
http://topic.csdn.net/u/20100722/16/0968fa7a-1975-4767-a983-951809a69360.html?seed=236868321&r=67224612#r_67224612
一样的问题,可是给沉了,

给个例子好吧大侠们,网上的例子运行不动啊,

我有一个网站台后,
有账号密码,不要验证码,
我想弄一个链接按钮什么的,点一下就自动登录上。不用输账号密码

------解决方案--------------------
up...
------解决方案--------------------
webbrwower
htpwebrequest
http://topic.csdn.net/u/20100604/18/fadb1e99-e010-4aad-9e4f-bf5f0f745ee1.html
------解决方案--------------------
给你顶
------解决方案--------------------
顶起 Mark上
------解决方案--------------------
http://topic.csdn.net/u/20090810/11/1d193df9-f3fb-487e-98ee-91bf7b5a9bf8.html
------解决方案--------------------
或者说你的是WebForm?
------解决方案--------------------
不用账号的话,,
怎么记录是谁登陆,又如何判断后台的操作权限;
这样的话不如点一下连接就直接经后台吧
------解决方案--------------------
探讨
是WEB网站想要自动登录到其它网站,有地址账号密码

------解决方案--------------------
用HttpWebRequest,先将用户名和密码发给服务器,将服务器返回的信息保存在cookie上,再登陆服务器就可以了。
------解决方案--------------------
最近也写过一个测试的工具 用的winfrom做的 自动登录网站 测试Http响应时间 页面加载时间
 账户密码写到XML 里面在 URL地址需输入 用了个timer 自动登录
HttpWebReques HttpWebResponse

 前提是得知道URl地址的拼接 把账户密码 直接拼接到URL里面 就可以自动登录

------解决方案--------------------
这个功能应该不难实现吧。
看一下,网站都需要提交什么数据,就照着样子提交就可以了。
------解决方案--------------------
模拟登陆, 通过截获和模拟HTTP请求来实现!
------解决方案--------------------
给你顶!~~~~~~~~~~~~~~
------解决方案--------------------
用webbrowser控件
 System.Windows.Forms.HtmlDocument HTMLDocument = wbHistorySearch.Document;
System.Windows.Forms.HtmlElement loginName= HTMLDocument.GetElementById("loginName");
loginName.InnerText = System.Configuration.ConfigurationSettings.AppSettings["LoginName"].ToString();
//loginName.Enabled = false;
System.Windows.Forms.HtmlElement password = HTMLDocument.GetElementById("passwd");
password.InnerText = System.Configuration.ConfigurationSettings.AppSettings["Password"].ToString();
//password.Enabled = false;
System.Windows.Forms.HtmlElement btnLogin = HTMLDocument.GetElementById("login");
btnLogin.InvokeMember("click");
btnLogin.Enabled = false;
System.Windows.Forms.HtmlElement btnReset = HTMLDocument.GetElementById("Submit2");
btnReset.Enabled = false;
------解决方案--------------------
当点击链接或按钮时 从后台取得账号和密码,然后跳转到相应的页面(在跳转的路径中包含账号和密码这两个信息)
------解决方案--------------------
C# code

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.IO;

namespace TestLoginWin.AppCode
{
    /// <summary>
    /// 访问WEB页面
    /// </summary>
    /// <author>Jailu</author>
    /// <date>May 10, 2008</date>
    public class HttpHelper
    {
        #region 私有变量
        private CookieContainer cc;
        private string contentType = "application/x-www-form-urlencoded";
        private string accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
        private string userAgent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14";
        #endregion

        #region 属性