android - Always Status Code is coming 401 -


i doing 1 form post basic authentication status code coming 401.

  httpclient httpclient = new defaulthttpclient();   httppost httppost = new httppost(url);    multipartentitybuilder builder = multipartentitybuilder.create();           builder.setmode(httpmultipartmode.browser_compatible);    builder.addpart("picture", new filebody(new file(picture)));   builder.addtextbody("firstname", firstname);   builder.addtextbody("lastname", lastname);    string base64encodedcredentials = "basic "   +base64.encodetostring((username+":"+password).getbytes(), base64.no_wrap);   log.d("authorization", base64encodedcredentials);    httppost.setheader("authorization", base64encodedcredentials);   httppost.setentity(builder.build());    httpresponse httpresponse = httpclient.execute(httppost);   httpentity httpentity = httpresponse.getentity(); 

but it's working in browser (advance rest client), please kindly go through code , suggest me solution.

compare http request you're sending 1 postman sending using tool feedler , see you're missing


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -