Discussion:
HTTP Proxy Credential Retrieval
(too old to reply)
Rich L.
2008-04-22 20:07:23 UTC
Permalink
Greetings,

I have an ActiveX control that uses WinINET. If the browser prompts
for username and password to traverse an outbound proxy, I need to
collect those credentials. This is documented in the MSDN as available
using the InternetQueryOption function. However, despite returning
(great) success the username returned is always empty. Here's the code
snippet.

InternetQueryOption( m_hRequest,
INTERNET_OPTION_PROXY_USERNAME,
NULL,
&cbUsername );
if ( cbUsername ) {
fSuccess = InternetQueryOption( m_hRequest,
INTERNET_OPTION_PROXY_USERNAME,
pszUsername,
&cbUsername );
if( fSuccess ) {
WCHAR bufr[MAX_PATH];
StringCchPrintf( bufr,
MAX_PATH,
L"Proxy username[%s] size[%d].",
pszUsername,
cbUsername);
MessageBox(NULL, bufr, L"Woot!", MB_OK);
} else {
MessageBox(NULL, L"Failed to get username.", L"Drag.", MB_OK);
}
}

Result is notebox with, "Proxy username[] size[0]." Thanks in advance
for any help.

Sincerely,
Rich L.
Volodymyr M. Shcherbyna
2008-04-24 13:19:27 UTC
Permalink
Hello,

Are you using IE6? Read this: http://support.microsoft.com/kb/324898
--
V.
This posting is provided "AS IS" with no warranties, and confers no
rights.
Post by Rich L.
Greetings,
I have an ActiveX control that uses WinINET. If the browser prompts
for username and password to traverse an outbound proxy, I need to
collect those credentials. This is documented in the MSDN as available
using the InternetQueryOption function. However, despite returning
(great) success the username returned is always empty. Here's the code
snippet.
InternetQueryOption( m_hRequest,
INTERNET_OPTION_PROXY_USERNAME,
NULL,
&cbUsername );
if ( cbUsername ) {
fSuccess = InternetQueryOption( m_hRequest,
INTERNET_OPTION_PROXY_USERNAME,
pszUsername,
&cbUsername );
if( fSuccess ) {
WCHAR bufr[MAX_PATH];
StringCchPrintf( bufr,
MAX_PATH,
L"Proxy username[%s] size[%d].",
pszUsername,
cbUsername);
MessageBox(NULL, bufr, L"Woot!", MB_OK);
} else {
MessageBox(NULL, L"Failed to get username.", L"Drag.", MB_OK);
}
}
Result is notebox with, "Proxy username[] size[0]." Thanks in advance
for any help.
Sincerely,
Rich L.
Continue reading on narkive:
Loading...