我在使用android中需要的身份验证访问http时遇到问题。我已经像下面的代码一样尝试了HttpUrlConnection:但是我仍然得到错误401 UNAUTHORIZED
String encoded = Base64.encodeToString((_username+":"+_password).getBytes(),Base64.NO_WRAP);
connection.setRequestProperty("Authorization", "Basic "+encoded);
connection.setRequestProperty("Connection", "Keep-Alive");
connection.setRequestProperty("Content-Type", "multipart/form-data;boundary="+boundary);
connection.setRequestProperty("Host", "crmweb.com.ph");
connection.setRequestProperty("Cookie", "");
connection.connect();
这是我想要放在android中的代码的图像:
感谢您的帮助。