Skip to content Skip to sidebar Skip to footer

Android Login To Website - Always Returns Login Page Data

I have a login form currently taking login parameters and logging into a website using HTTP Post Request. I am unsure of the server type so that could be the problem. Once it takes

Solution 1:

To check for HTTP status. Do something like this

if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
   //Do Something here.. I'm logged in.
} elseif (response.getStatusLine().getStatusCode() == HttpStatus.SC_UNAUTHORIZED) {
    // Do Something here. Access Denied.
} else {
    // IF BOTH CASES not found e.g (unknown host and etc.)
}

This will exactly works as you want to check for status. thanks

Solution 2:

I guess the problem is similar to this question. Check it out, there are some solutions, which might work for you in solving it.

Post a Comment for "Android Login To Website - Always Returns Login Page Data"