Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.NET verifying POST request result [closed]

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

like image 655
ddl Avatar asked Jan 20 '26 06:01

ddl


1 Answers

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.

like image 198
Reactgular Avatar answered Jan 22 '26 19:01

Reactgular