1
我对以下用于认证大学校园网站的测试方法存在问题。 我正在使用Jsoup,我无法获取cookie(jsessionid)登录。 的方法是这样的:如何使用jsoup设置jsessionid cookie?
public static void Authentication() {
String strURL = "https://www.studenti.ict.uniba.it/esse3/auth/Logon.do";
String strUserId = "prova";
String strPasword = "prova";
String authString = strUserId + ":" + strPasword;
String encodedString = new String(Base64.encodeBase64(authString.getBytes()));
try{
Response response = Jsoup.connect(strURL)
.header("Authorization", "Basic " + encodedString)
.method(org.jsoup.Connection.Method.GET)
.timeout(30000)
.execute();
System.out.println(response.parse());
System.out.println("Autenticato");
}catch (IOException e){
e.printStackTrace();
}
}
谢谢。 cookie的帮助非常好。现在的问题是,它不会登录并给我错误401,虽然访问凭证是正确的。错误出现在“执行”功能中。 –
@VincEnzo问题是,如果我没有证书,我无法测试它。 –
你可以给我发电子邮件吗?你发送的登录凭证 –