I'm getting stuck with http request using HttpClient that is working fine with 2.2 or 2.3.X versions. But it is giving me 401 error when I will tried to send that request from my android tablet with version 4.0.3
Here is my code that I have implemented.
HttpClient client = new DefaultHttpClient();
    HttpConnectionParams.setConnectionTimeout(client.getParams(), 10000); //Timeout Limit
    HttpResponse response;
    JSONObject json = new JSONObject();
    try{
        HttpPost post = new HttpPost("MYURL");
        json.put("username", username);
        json.put("password", password);
        StringEntity se = new StringEntity( json.toString());  
        se.setContentType(new BasicHeader(HTTP.CONTENT_TYPE, "application/json"));
        post.setEntity(se);
        response = client.execute(post);
        /*Checking response */
        statusCode = response.getStatusLine().getStatusCode();
        System.out.println("Status Code=>" + statusCode);
        if (statusCode == 200) {
            result = EntityUtils.toString(response.getEntity());
            Log.v("Login Response", "" + result);
        } else {
            response = null;
        }
    }
    catch(Exception e){
        e.printStackTrace();
        //createDialog("Error", "Cannot Estabilish Connection");
    }
Help me to solve this problem with your best suggestions.
Thanks,
 
     
     
     
    