Solved

Internet access through proxy that needs username/password verification

Posted on 1998-08-26
8
372 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
  • 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 131
VBA "SendKeys" Syntax for Multiple Keystrokes 7 103
modThree challenge 4 77
Detect file exist or not 3 130
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now