1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Net;
using System.Web;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using WatiN.Core;
namespace MyNameSpace
{
public partial class Form1 : System.Windows.Forms.Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
string setcookieValue;
setcookieValue = "__utmb=monCookie";
IE MyBrowser = new IE("http://www.developpez.net/forums/");
MyBrowser.SetCookie("http://www.developpez.net/forums/", setcookieValue);
MyBrowser.WaitForComplete();
string cookies = MyBrowser.GetCookie("http://www.developpez.net/forums/", "__utmb");
if (cookies!=null)
{
sauveMoi.Text = cookies;
}
else
{
MessageBox.Show("c'est vide!");
}
}
}
} |
Partager