Solved

Internet access through proxy that needs username/password verification

Posted on 1998-08-26
8
358 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

708 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

17 Experts available now in Live!

Get 1:1 Help Now