Mail input method for Asp.net form using Jsoup

I am trying to login at http://www.investabroadproperties.com/ with the following code

Connection.Response loginForm = Jsoup.connect("http://www.investabroadproperties.com/") .method(Connection.Method.GET) .execute(); Document document = Jsoup.connect("http://www.investabroadproperties.com/") .data("ctl00$ctl02$tbEmail", "myemail") .data("ctl00$ctl02$tbPassword", "mypassword") .cookies(loginForm.cookies()) .post(); 

But I can not enter this site. Studying the source of the html site, I see that there are several hidden fields, as shown below, but with empty values. There is also an attribute onsubmit="javascript:return WebForm_OnSubmit();" I'm not sure how to use it.

enter image description here

I also see this post , but I could not understand the logic / code that is given in the accepted answer (maybe this will help).

Can someone help me how can I log in to the site?

I am using java and jsoup.

EDIT

I also tried under the code, but still no luck

 Connection.Response loginForm = Jsoup.connect("http://www.investabroadproperties.com/") .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1") .method(Connection.Method.GET) .execute(); Document doc = loginForm.parse(); Elements hiddenElems = doc.select("input[type=hidden]"); Map<String, String> nameValue = new HashMap<>(); for(Element elem : hiddenElems) { nameValue.put(elem.attr("name"), elem.attr("value")); } Document document = Jsoup.connect("http://www.investabroadproperties.com/") .userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1") .data("ctl00$ctl02$tbEmail", "myValidEmail") .data("ctl00$ctl02$tbPassword", "myValidPassword") .data(nameValue) .cookies(loginForm.cookies()) .post(); 
+5
source share
1 answer

The following image was taken from my browser developer tools. As you can see, your request is still missing some values:

post request

You must send all these values ​​to the server.

+3
source

Source: https://habr.com/ru/post/1270562/


All Articles