c# - Use cookies from CookieContainer in WebBrowser -
is there way can use cookies cookie container (taken webrequest previously) , use them in webbrowser control? if so, how this? winforms application in c#.
you need make use of internetsetcookie. here sample...
public partial class webbrowsercontrol : form { private string url; [dllimport("wininet.dll", charset = charset.auto, setlasterror = true)] public static extern bool internetsetcookie(string lpszurlname, string lbszcookiename, string lpszcookiedata); public webbrowsercontrol(string path) { this.url = path; initializecomponent(); // set cookie internetsetcookie(url, "jsessionid", globals.thisdocument.sessionid); // navigate webbrowser.navigate(url); } }
Comments
Post a Comment