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

C# 模拟登录后,怎样打开登录后的网页页面?
如题,C#模拟登录网页(具体是博客),登录成功后(代码实现,自己已经把登录的代码写出来了),怎样打开登录后的页面?需要调用哪个函数(本人新手),csdn的热心朋友,帮帮忙!谢谢!有代码就贴一下吧!

------解决方案--------------------
记录下Cookei打开别的页面的时候把你登录后的Cookie发送过去。


------解决方案--------------------
没做过 不知道
------解决方案--------------------
引用:
引用:

记录下Cookei打开别的页面的时候把你登录后的Cookie发送过去。

两钻大哥,好激动啊!我的代码如下:
public class HttpHelper
    {
        public static CookieContainer Cookies = new CookieContainer();
        public static……


正是这个 CookieContainer。下面的登录3dezu网站并留言的代码,供参考:

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.Net;
using System.Text.RegularExpressions;
using System.Web;
using System.IO;
using System.IO.Compression;
using System.Threading;

namespace login3Dezu
{
    public partial class Form1 : Form
    {
        CookieContainer cc = new CookieContainer();
        string formhash = null;
        BackgroundWorker bw = new BackgroundWorker();
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            bw.WorkerReportsProgress = true;
            bw.WorkerSupportsCancellation = true;
            bw.DoWork += new DoWorkEventHandler(bw_DoWork);
            bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged);
            bw.RunWorkerAsync();
        }

        void bw_DoWork(object sender, DoWorkEventArgs e)
        {
            while (!bw.CancellationPending)
            {
                StringBuilder sb = new StringBuilder();
                Encoding code = Encoding.ASCII;

                bw.ReportProgress(1,"当前日期:"+DateTime.N