So I'm trying to login to a asp.NET server over HTTPS via Android HttpClient Post.
When the POST request is executed, it will return one of two possibilities:
-An error login page (with Status Code 200) -Successful Login default screen (with status code 302 -- theres a 302 redirect to the successful default page).
Sometimes it takes 开发者_开发问答a while to load because I believe it is trying to read the whole content of the page, when all I truly need is the Status Code.
Here's my code:
response = client.execute(post,localContext);
name.post(new Runnable(){
public void run(){
name.setText("Http Code: "+response.getStatusLine().getStatusCode());
}
Is there anyway to make it only request/return the header tags so the user doesn't have to wait while it reads the entire page?
Also, it seems that even if I am using a correct user/pass, it returns 200, NEVER a 302. I can post the source for that too, but what could be the problem? Could it be something HTTPS vs HTTP?
Thanks!:)
精彩评论