Rich L.
2008-04-22 20:07:23 UTC
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.
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.