I know there are libraries that are used to parse html like HTMLAgilityPack but unable to find a library that supports form posting or executing javascript. I want to post html form from my Windows Form application but don't want to use WebBrowser control or MSHTML library.
-
Javascript: no, but as for POST, just read up how to construct those requests. – leppie Jul 21 '11 at 11:32
-
By saying form post I meant to submit form after filling it. – Software Engineer Jul 21 '11 at 12:22
1 Answers
There can be multiple solutions here because the act of creating a POST request and sending it to a server is separate from the act of parsing and executing JavaScript.
That said, if you want to create a POST request, there are multiple options in .NET, the most prominent being the HttpWebRequest
/HttpWebResponse
classes, as well as the WebClient
class, which is a higher level wrapper around HttpWebRequest
/HttpWebResponse
.
For executing JavaScript, the assumption is that you want to execute JavaScript in the page, and while there are stand-alone .NET JavaScript parsers/execution engines out there, they don't necessarily work in the page.
To that end, the MSHTML library (even though you said you didn't want to use it, I imagine you are on a server and have threading/COM apartment issues?) is really a good choice, and you can wrap access to it sufficiently in .NET (although not easily, depending on your needs) to allow you to do what you want.
If you are a fan of WebKit, then you can use the .NET wrapper for WebKit (WebKit.NET) in your application. Note: there are some issues as of September 2011, which might or might not be addressed by now.