开发者

Change Cookie not working

I am using web browser and trying t开发者_如何转开发o change the cookies but the cookie remains null i donot know why

any idea why it does not changes.i tried to monitor but observed that the method InternetSetCookie is not changing it,but the page that was navigated to renders and page changes cookie not my method

  [DllImport("wininet.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern bool InternetSetCookie(string lpszUrlName, string lbszCookieName, string lpszCookieData);
InternetSetCookie(textBox1.Text, null, "123");  
             webBrowser1.Navigate(textBox1.Text);


Don't pass null for the cookie name. And do pay attention to the return value, you should get false here because of the invalid name. Use throw new Win32Exception() so an error doesn't go unnoticed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜