Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

InternetConnect http question

Posted on 2001-06-12
4
Medium Priority
?
347 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 800 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

660 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