Programmatically load, fill , and submit a web form using webbrowser control in Windows Phone
I need to load the yahoo login form into the Windows Phone webbrowser control, fill user name, password & check the "Keep me sign in" check box and finally submit the form. I used HttpWebRequest to save the login page source into a string. After that, I inject a javascript into the page source string, to fill the login form and submit it. The login was successful.
After that I need to post or reply to Yahoo Finance Message Board. I tried to do that in a similar way as applied for login to yahoo. Form was successfully submitted. But page is redirected to the login form again, prompt for user name and password. That means the login state开发者_Python百科 information was not saved in the Windows Phone webbrowser control.
Please help me.
Make sure you save the cookies which are returned after a successful login and then resubmit them with the subsequent request.
This is not an issue with the WebBrowser control this is the way the web works. HTTP is stateless.
Why not just do everything yourself with HttpWebRequest? You would gain complete control over everything and then not have issues about sharing cookies between your web requests and those made using the control.
精彩评论