I ve done this sample to try to understand why I m not sending cookies at all with my WebBrowser, it s pretty simple, the form has a WebBrowser on it, that s all:
namespace BrowserTest
{
public partial class Form1 : Form
{
[DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool InternetSetCookie(string url, string name, string data);
public static bool SetWinINETCookieString(string url, string name, string data)
{
return Form1.InternetSetCookie(url, name, data);
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// None of two works
//SetWinINETCookieString("www.nonexistent.com", null, "dataToTest=thisIsTheData");
SetWinINETCookieString("www.nonexistent.com", "dataToTest", "thisIsTheData");
this.webBrowser1.Navigate("www.nonexistent.com");
}
}
}
而Fidller说的是我寄来的:
象每个人都利用这一职能一样,但对于我来说,我无法工作。 我用不同的电脑进行审判,也失败了。 任何帮助都是巨大的。