Cannot change the username / password after the first digest challenge

137 views
Skip to first unread message

mterrisse

unread,
Aug 13, 2010, 4:27:09 AM8/13/10
to
Hello,

I am using Internet Explorer 8 (Windows 7 64-bit).
In some code I connect to a web service that requires Digest http
authentication. The client side uses Wininet APIs.
I first call InternetSetOption (INTERNET_OPTION_USERNAME /
INTERNET_OPTION_PASSWORD) to specify the login and password, then call
HttpSendRequest ().
This works fine.
But If I want to change the username or the password and call again
InternetSetOption (INTERNET_OPTION_USERNAME /
INTERNET_OPTION_PASSWORD), the next call to HttpSendRequest () still
sends the previous username.
I found no way to reset the connexion from the client side.

This looks similar to this bug
http://support.microsoft.com/kb/195567/en-us
except that this was a bug of Internet Explorer 4 and now I use
Internet Explorer 8.

I tried to unload Digest Ssp with InternetSetOption
(INTERNET_OPTION_DIGEST_AUTH_UNLOAD) before specifying the new
UserName / Password, this does not change anything.
If I wait for more than 3 minutes, then the server automatically
closes the connection, so the next time I try it works fine.

Any idea ?

Regards,

Michel

mterrisse

unread,
Aug 13, 2010, 5:10:00 AM8/13/10
to
I could read this here
http://groups.google.fr/group/microsoft.public.inetsdk.programming.wininet/browse_thread/thread/d4ffdd9045023a28
WinInet implements a process-wide "keep-alive" socket pool, which
allows it to reuse an existing socket connection for a subsequent
request to the same server:port destination, avoiding the overhead of
setting up a new TCP connection. So closing your WinInet HINTERNET
handles does not imply that the associated socket connection is
closed.

So I tried to open a connecion without keep-alive, but it seams that
the connection keeps alive anyway. Is the connection keep-alive by
default, and is there a way to force it not to keep alive ?

Michel

mterrisse

unread,
Aug 13, 2010, 6:16:11 AM8/13/10
to
I have the solution (thanks to http://support.microsoft.com/kb/195192/en-us)
I just need to call InternetSetOption
(INTERNET_OPTION_END_BROWSER_SESSION) when I change the username or
the password.
This works fine now!

Michel

Reply all
Reply to author
Forward
0 new messages