I need my application to log in on site with user defined login and password. Although sending POST data is very simple I can't manage how to check if returned page shows "logged in" or "wrong password" statement.

Searching .html string for specified statement is too slow and comparing pre-seted error page is not working because page is dynamic loaded (with same url).

Is there any lib for managing .html content? I could use java or python as well as c# if i had to
['https://Stackoverflow.com/questions/20952372', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2843974/']
I made some research and found that regular expression perfectly fits my problem as they are **easy to implement**, and **really fast in that case**.

If anyone would also have a problem like that:

```
using System.Text.RegularExpressions;

// .html document returned by page
string webRequestResponse = getResponse();
// site error string
const string REGEX = "Password is not correct.";
// check if page contain that error
bool wrongPassword = Regex.IsMatch(webRequestResponse, REGEX);

```
Problem with logging in via a script, web-sites return `200 OK` response on both of login outcomes: logged in or not logged in. So you'll have to parse the incoming html for the required string to verify successful credential check. There is no other way for that, unless the site provides some API.

The best way to parse resulting HTML is using [HTML Agility Pack](http://htmlagilitypack.codeplex.com/). I've used it in the past and it was a blast to get the required strings out of the pages.