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/']
Eat Your Cookies
================

The majority of websites will use cookies to track the current user's session across multiple requests. You'll have to attach a cookie storage to your WebRequest when sending the POST request, and inspect the storage for the login response.

Each website will implement their session tracking differently. So there is no one solution fits all, but for most cases all you'll have to do is verify that a cookie exists under a given name. What the cookie contains doesn't matter, but when that cookie exists you know login was successful.

That cookie storage will have to be used for additional requests from the server for that user session. So you'll likely need to track cookies anyway.

Websites can use other methods to track user sessions, including a session ID in GET parameters or use the web servers persistent connection.

I don't know to many websites that log user's in that don't use cookies to track user sessions. I'd look there first.
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);

```