CAtlHttpClient and authentication

  • Thread starter Thread starter Thy
  • Start date Start date
T

Thy

Bonjour

I use CAtlHttpClient to send parameters to a Linksys router by HTTP protocol
(SNMP not activated by default). HTTP is password protected.
I use Ethereal/WinPCap to trace exchange beetween PC and router.

When I try to get datas (ATL_HTTP_METHOD_GET) , CAtlHttpClient try first to get
datas without password, Router send error 401, so CAtlHttpClient retry with
password.

When I try to post datas (ATL_HTTP_METHOD_POST), CAtlHttpClient try first to
send datas without password. As router doesn't answer error 401, CAtlHttpClient
doesn't retry to send datas with password.
The only solution I've found is to add encrypted password to the header, but
it's not a good solution (the password will change and I don't know the encoding
method).

Is there a solution to force CAtlHttpClient to send password without waiting
errors 401 or 407 as describe in Microsoft documentation ?

TIA.
 
AFAIK, there isn't way of passing your credentials using CAtlHttpClient if
the server response is different than 401 or 407. Maybe, you can use
WinHttp. WinHttp allows you to explicitly set the user credentials before
sending a request to the server, see WinHttpQueryAuthSchemes and
WinHttpSetCredentials documentation, not only if the server response is 401
or 407 like CAtlHttpClient.

--
Un saludo
Rodrigo Corral González [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top