Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

[Solved] Automatically login to website and get cookie

I'm trying to automatically login at archive.org to get the main cookie "logged-in-sig" and "logged-in-user".

Through Postman I've been configurated a POST call to the account/login.php page with the parameters "username: [email protected]", "password: password" and "action: login", it works and I get the cookie that interest me.

The real problem is when I try to do the same on C# code.

RestSharp generated with Postman
Code
var client = new RestClient("https://archive.org/account/login.php");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "32223140-xxxx-80b7-ef90-37ccdf4d77f0");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
request.AddParameter("undefined", "[email protected]&password=password&action=login", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

So, how is possible automatically login at archive.org to get "logged-in-sig" and "logged-in-user" cookie? Thanks

-------

UPDATE

Solved adding request.AddCookie("test-cookie", "1");
Probably a site security check

Thread can be close
Even though you solved it already, allow me to give you some advice; usually, the first thing you want to do if your request is not working, is run a local proxy like Fiddler to sniff the requests. Compare the request made by your program with the actual request, and if the request from your program is any different then fix that difference immediately. Because in the end, all it is is a string that is sent to the server.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by AnonCensoredDec 23, 2015 03:06 PM 5 229 Dec 23, 2015 03:06 PM
Last Post: poopGod
[.NET] by SIM-2362662Dec 23, 2015 08:56 AM 11 285 Dec 23, 2015 08:56 AM
Last Post: SIM-2362662
[.NET] by iSmileMar 27, 2015 12:38 PM 4 251 Mar 27, 2015 12:38 PM
Last Post: iSmile