I have problem when trying to login to Moody's website using Jsoup. I had no problems with other sites, but the way I login in other cases doesn't work for Moodys.
This is my code:
Response initialResponse = Jsoup.connect("https://www.moodys.com/login.aspx")
.execute();
Response loginResponse = Jsoup.connect("https://www.moodys.com/login.aspx")
.cookies(initialResponse.cookies())
.data("MdcUserName", "username")
.data("MdcPassword", "password")
.method(Method.POST).execute();
doc = Jsoup.connect("any other moody's page")
.cookies(loginResponse.cookies())
.timeout(3000000).get();
System.out.printl(doc.html());
But this does not work. What am I doing wrong? Thank you.