Hi Tobi,

Thanks for your help. The link you told is useful for HttpClient 3.1 but
there is a lot of difference between 4.0 and 3.1.

I solved my problem. This is the solution.

HttpGet httpGet = new HttpGet(url);
UsernamePasswordCredentials credentials = new
UsernamePasswordCredentials(username, password);
                BasicScheme scheme = new BasicScheme();
                Header authorizationHeader = scheme.authenticate(credentials,
httpRequest);
                
                httpGet.addHeader(authorizationHeader);


Regards,
Kashif



Tobias N. Sasse wrote:
> 
> kash_meu schrieb:
>> Thanks. I am not getting any error messages. But the output is not right.
>> When I paste http://[email protected]/abc.php in the browser, I
>> get
>> the right output. But on running the client, the output is not what I am
>> expectin
> 
> Hi, I have no idea of authentication myself, but you should probably 
> have a look at this tutorial:
> 
> http://hc.apache.org/httpclient-3.x/authentication.html
> 
> I know this is for version-3 but perhaps you get an idea how it could 
> work. I guess the problem is that providing the username and password in 
> the URL string is not the way httpclient is triggert to provide 
> authentication to the server?
> 
> Regards,
>     Tobi
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/BasicAuthentication-using-HttpClient-4.0-tp25578027p25624006.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to