Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Programatically pass "UserName", "PassWd" and "DomainName" for proxy authentication?

1 view
Skip to first unread message

R.Padmakumar

unread,
Jun 3, 2002, 3:40:39 PM6/3/02
to
Hi,

The Proxy that i am using is having a strictly configured ISA server
such that the internet clients (eg IE, Netscape or some customized
internet clients) needs to authenticate by giving a
1. User Name
2. Pass Word
3. Domain Name

(If i am using IE and trying to open a url, immidiatly IE prompts a
dialog for "User Name", "Pass Word" and "Domain Name" that are used
for authentication from the serverside. These credentials are normally
my emailid/password/email-domain-name)

I am trying to write a program that uses the following APIs for
accessing the internet and download a page..
//START
HINTERNET goInetHnd;
HINTERNET aoURL;

//OPEN CONNECTION
goInetHnd = ::InternetOpen (
STD_BROWSER_SIG,
INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0
);

//SPECIFY AUTHENTICATION USERNAME
strcpy (azUser,"user-name");
aiUsrLen=strlen (azUser);
InternetSetOption (goInetHnd, INTERNET_OPTION_USERNAME, azUser,
(unsigned long)aiUsrLen);

//SPECIFY AUTHENTICATION PASSWORD
strcpy (azPass, "pass-word");
aiPasLen=strlen (azPass);
InternetSetOption (goInetHnd, INTERNET_OPTION_PASSWORD, azPass,
(unsigned long)aiPasLen);

//OPEN URL
aoURL = ::InternetOpenUrl (
goInetHnd,
azUrl,
NULL, 0, 0, 0
);

//GET PAGE DATA
InternetReadFile (aoURL, azTemp, aiReadLen, &aiLen); // placed in loop

//CLOSE URL
InternetCloseHandle (aoURL);
//END

Here i donno how to specify the "domain name" authentication. There is
no option in InternetSetOption API like INTERNET_OPTION_DOMAINNAME. I
also tried by passing the domain-name along with user-name as
//SPECIFY AUTHENTICATION USERNAME
strcpy (azDomAndUser,"domain-name\\user-name"); // strcpy
(azDomAndUser,"\\domain-name\\user-name");
aiDomUsrLen=strlen (azDomAndUser);
InternetSetOption (goInetHnd, INTERNET_OPTION_USERNAME, azDomAndUser,
(unsigned long)aiDomUsrLen);
And this is also not working..

Actually, the returning page has the following text.
HTTP 407 Proxy Authentication Required - The ISA Server requires
authorization to fulfill the request. Access to the Web Proxy service
is denied. (12209)
Internet Security and Acceleration Server

This error message is very similar to the page that is obtained by
cancelling the authentication dialog.

I am in extreme need to obtain a good optimum solution for this.. if
possible by using WinInet API. Please let me know your suggestion.

Regards
R.Padmakumar

0 new messages