c# 4.0 - WebBrowser Control C# -
hi im using webbrowser control login url https://direct.gov.mb.ca/ppr/jsps/login/login.jsp after entering correct username & password redirected non member page, (im still not logged in), used fiddler , did steps in browser , logged in , diff saw in fidler between program , regular browser, in browser when type same url , 2 cookies in header strange ,dont know gets cookies, program obviousely there no cookie in header, after login regular browser there 5 cookies in response program there 2 cookies
i want mention there nothing wrong code , because logged in other https website , http websites , there unique site, how on come issue, been 3 days , not figure out
edit: code
htmldocument doc = webbrowser1.document; htmlelementcollection elemsname = doc.all.getelementsbyname("username"); int count = elemsname.count; htmlelement elmname = elemsname[0]; elmname.setattribute("value", "xxxxx"); htmlelementcollection elemspass = doc.all.getelementsbyname("password"); htmlelement elmpass = elemspass[0]; elmpass.setattribute("value", "xxxxx"); htmlelementcollection elemssubmit = doc.all.getelementsbyname("loginaction"); htmlelement elmsubmit = elemssubmit[0]; elmsubmit.invokemember("click");
but said code works other sites facebook.com
did try clean cookies before opened page "regular browser"? if yes, count of cookies still same?
are user agents same in webbrowser , regular browser? if not, can try set them with:
[dllimport("urlmon.dll", charset = charset.ansi)] private static extern int urlmksetsessionoption(int dwoption, string pbuffer, int dwbufferlength, int dwreserved); const int urlmon_option_useragent = 0x10000001; private const string useragent = "your user agent"; urlmksetsessionoption(urlmon_option_useragent, useragent, useragent.length, 0);
have checked post body (textview) https://direct.gov.mb.ca/ppr/actions/logindispatcher? same?
Comments
Post a Comment