Solved

InternetConnect http question

Posted on 2001-06-12
4
343 Views
Last Modified: 2013-12-03
I'm haveing a bit of trouble understanding the WinInet InternetConnect function call as it applies to username & password for a http session.

The documentation says:
; a NULL parameter in HTTP causes the server to return an error
Is that really true!!?? and just what is InternetConnect doing at this point for a http session? Just opening a socket? If so what would it do with any username and password supplied anyway? Maybe save them up and use them in subsequent HttpOpenRequest?

Any insight into what is going on with respect to user details and the InternetConnect function as far as http is concerned would be greatly appreciated.
0
Comment
Question by:GGRUNDY
[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
  • 2
4 Comments
 
LVL 5

Expert Comment

by:robpitt
ID: 6180417
Darn good question! I see no reason why NULL could not have been accepted yet the docs do indeed state a username paramter is required for HTTP.


As for asking for the username/password at this early stage, well I guess its just so that it can cache it for use later on when a page requiring authentication is encountered.
0
 
LVL 32

Accepted Solution

by:
jhance earned 200 total points
ID: 6180864
If no username or password is needed you pass it an EMPTY STRING but NOT NULL!  There is a difference:

TCHAR *lpszEMPTYSTRING = _T("");

is distinct from:

TCHAR *lpszNULLSTRING = NULL;

As to WHY?  Who knows?  Probably some lazy programmer forgot to take care of this and rather than change the code, they changed the docs.  

Look at the bright side.  At LEAST THEY DOCUMENTED IT!!  
0
 
LVL 3

Author Comment

by:GGRUNDY
ID: 6184051
Hi Guys thanks for your comments thus far.
But I'm still pretty interested in what (if anything) it does with username & password in the case of internet connection.
I have since found a document which says that in the case of a HTTP connection InternetConnect doesn't go anywhere near the site at that point. http://msdn.microsoft.com/workshop/networking/wininet/overview/enable.asp
From the article
InternetConnect does not attempt to access or establish a connection to the specified site, except in the case of an ftp session.

I also note that MFC's CHttpConnection class seems quite keen to pass NULL parameters for Username and Password. So it is probably the documentation in error. (Although the above article repeats the fallacy).
(In fact I get the impression from the documentation of the InternetConnect function had an author with only a passing acquaintanceship with the English language).
0
 
LVL 3

Author Comment

by:GGRUNDY
ID: 6199397
Thanks for trying anyway guys
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need example 5 137
Windows Process running 3 67
WPF - External data binding to controls inside a UserControl 2 95
Where to obtain Oracle Data Provider for .NET 3.5 7 62
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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