Solved

Internet access through proxy that needs username/password verification

Posted on 1998-08-26
8
419 Views
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 :-)
0
Comment
Question by:regina081698
[X]
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
8 Comments
 
LVL 2

Expert Comment

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

Expert Comment

by:milenvk
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.
0
 

Author Comment

by:regina081698
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?
0
Technology Partners: 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

by:
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
http://username:password@www.webpage.com
ftp://username:password@ftp.ftpsite.com

Try using this format (username:password@proxyhere.proxy.com) in the proxy name string for you CInternetSession constructor.

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

Author Comment

by:regina081698
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...

Reg.
0
 

Author Comment

by:regina081698
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.)

0
 

Expert Comment

by:blueoak
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.
0
 

Expert Comment

by:blueoak
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().
0

Featured Post

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!

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

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