I am facing some issue with webbrowser control. I login to a site using webclient c#. Then at a point I show website in browser. So I grab cookie from webclient and set cookies to webbrowser using InternetSetCookie and then navigate to the page. What happens next is I get screen in webbrowser where I login but it logout immidiatly.
I dont understand why it is happening, I need help at this point.
I use this function to set value of cookie in webbrowser..
[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 InternetSetCookie(url, name, data);
}
Here is where I get data from webclient object and make a new post in webbrowser control.
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
byte[] byteArray = encoding.GetBytes(sPostParameter);
string authHeader = oBankcl1.PAYMENT_PAGE_AUTH_HEADER1;
InteropServicescl oInteropServicescl1 = new InteropServicescl();
oInteropServicescl1.ChangeUserAgent("Mozilla/5.0 (Windows T 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.116 Safari/537.36");
CookieCollection oCookieCollection = Cookiecl.GetAllCookies(webClient.CookieContainer);
AddCookieFromCookieColl(oCookieCollection);
this.wbWebbrowser.Navigate("https://www.abc.co.in/add/main.jsf", string.Empty, byteArray, authHeader);
here i see my website in browser but it trigger logout url after 1 sec and gives login screen. i dont understand who trigger logout.
please help me on this.i need this thing . i have trie latest version of ie from this post http:
What I have tried:
I grab cookie from webclient and set cookies to webbrowser using InternetSetCookie and then navigate to the page
see above