Solved

InternetConnect http question

Posted on 2001-06-12
4
340 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
  • 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
Run Program using VBScript 3 74
Issue testing the Class Library 4 60
How to LOAD up a .NET Framework website with data? 2 58
Please explain purpose of GZIP 4 37
This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

820 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