日期:2014-05-17  浏览次数:20834 次

模拟登陆成功后 无法保存COOKIE

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Diagnostics;
using System.Windows.Documents;

namespace ID_中心登陆
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form.CheckForIllegalCrossThreadCalls = false;
            Thread thread = new Thread(new ThreadStart(login));
            thread.Start();
        }

        public void login()
        {
            string cookie = "";
            string content = Http.httpGet("http://check.ptlogin2.qq.com/check?uin=" + txtuser.Text + "&appid=1006102&js_ver=10021&js_type=0&login_sig=HdN3svu2cSDSrocIOprFaBOvvEpW5-gD2qXdvRAylcMd8e-ziEHKOqww376ZXz3r&u1=http%3A%2F%2Fid.qq.com%2Findex.html&r=0.751604591311832", cookie, ref cookie, "http://id.qq.com/index.html");
            Debug.Print(content);
            string code = Http.Content(content, "','", "','");
            string uin = Http.Content(content, "\\x", "')");
            if (code.Length > 4)
            {
                Stream sr = Http.httpPic("http://captcha.qq.com/getimage?&uin=" + txtuser.Text + "&aid=1006102&0.9609332418713563", cookie, ref cookie, "http://captcha.qq.com/");