Reputation: 1331
I'd like to handle a simple web form from my application without showing the web site to the user. So, I should handle web form submit for credentials and then also handle another web form data and submission, as well as do some minor parsing from resulting pages. How should I tackle this problem, which control should be used? A nudge in proper direction will be most appreciated.
Upvotes: 0
Views: 119
Reputation: 66882
Traditional ASP.Net webforms are notoriously difficult to manipulate from code - especially when things like ViewState are required. In the case of one of these beasts, then your best bet is probably to setup a hidden WebBrowser control and to then use javascript commands to manipulate and submit the form (YUK!)
If, however, your form is a more clean ASP.Net MVC form with known parameter names, then you can probably quite easily make an appropriate HTTP GET or POST request using WebClient or HttpWebRequest from C#.
To work out what the web request needs to look like, try Fiddler2.
To understand HttpWebRequest in full .Net, see http://www.codeproject.com/Articles/18034/HttpWebRequest-Response-in-a-Nutshell-Part-1 - but you'll need to adjust this approach to use the async APIs on WP7
Upvotes: 2