Internet access through proxy that needs username/password verification

Posted on 1998-08-26
Last Modified: 2013-11-20
Could anyone PLEASE tell me how do I access Internet through a proxy that needs username/password verification? The Microsoft FTPTREE sample doesn't work... (I can access Internet through IE4 where I get a dialog box asking me for username and password - how is that implemented?)

P.S. Yes, I'm still "dumb" - this is my 2nd week programming in MFC :-)
Question by:regina081698
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2

Expert Comment

ID: 1321342
Try to use the MFC internet classes like CFtpConnetion and CHttpConnection or work directly with WinInet functions.

Expert Comment

ID: 1321343
Especially consider using the InternetOpen() function - it has some proxy stuff and is one of the WinInet functions. WinInet does not have to do anything with MFC, though MFC has some wrapper classes around WinInet, but using WinInet is really easy.

Author Comment

ID: 1321344
Dear milenvk, Thanks for your answer!

I know about these functions, but they do not tell me how to handle proxy requests for username and password. The proxy won't let me through without proper identity verification...

Do you know how I can do that?
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Accepted Solution

blueoak earned 50 total points
ID: 1321345
I have programmed internet applications using proxies, but these proxies don't require user name/passwords. However http and ftp requests have the username and password preceding the URL.

for example

Try using this format ( in the proxy name string for you CInternetSession constructor.

Let me know if this solved the problem. I'm interested in it too.

Author Comment

ID: 1321346
Dear blueoak,

Thanks for your suggestion. But isn't that the username and password in "ftp://username:password@ftpsite" meant for the ftpsite and not the proxy? Oh yes, do you know what happens when you http to a site like experts-exchange - you also get a login box right? So, let's say you write a program to http to this site - how would you do it, i.e. handle the username and password request from the server?

Thanks again, appreciate all the replies...


Author Comment

ID: 1321347
Sorry blueoak, missed out on the text below, ie. setting username:password@proxysite. Tried that just now. Doesn't work :-( I suspect the format username:password is handled internally by IE or Netscape... and is not a proper URL as such.)


Expert Comment

ID: 1321348
As for the proxy username:pass, sorry it didn't work out. If I had a proxy account that required a username:pass, I'd test some stuff.

As for Http password requests. After you CHttpFile::SendRequest() you can call CHttpFile::QueryInfoStatusCode () which will return the result of your SendRequest(), if you recived a HTTP_ACCESS_DENIED, then you can call CHttpFile::ErrorDlg(). ErrorDlg() does some of the dirty work in resending a request with the appropriate headers and options. I can't provide the actual code, since I haven't used this class member function yet, however it should work if set up with the correct flags.

Expert Comment

ID: 1321349
Before ErrorDlg() resends the request, it can prompt the user for the username/password with a message box, provided that's the situation. That's part of the dirty work I was referring to. Sorry the previous message was so vague.

You'll have to look up CHttpFile::ErrorDlg().

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
bobThere java chalenge 45 97
fizzArray  challenge 1 115
matchUp  challenge 6 82
Path of Workbook 3 87
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In an interesting question ( here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question