wininet session

I am trying to log into webmin using wininet.  I use the following functions:

InternetOpen();
InternetConnect();
HttpOpenRequest();
HttpSendRequest();
InternetReadFile();

The problem is what I read back is:
<h1>Error - No cookies</h1>
<pre>Your browser does not support cookies, which are required for this web serv
er to work in session authentication mode</pre>

How do I make my wininet application support cookies?
LVL 5
lwinkenbAsked:
Who is Participating?
 
ee_ai_constructConnect With a Mentor Commented:
Closed, 500 points refunded.
ee_ai_construct
Community Support Moderator
replacement part #xm34
0
 
jkrCommented:
Check your IE settings, if they are set to not allow cookies, that will affect Wininet, too.
0
 
lwinkenbAuthor Commented:
I can log in just fine with IE.  My guess is that I either have to do one of the following:

- Pass an option to one of the functions I listed above that tells the session I am accepting cookies
- Pass an additional HTTP header which tells the server I accept cookies
- Write the cookie manually somehow

I've been reading the wininet documentation, but I haven't come across anything substantial yet.
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
jkrCommented:
>>I've been reading the wininet documentation, but I haven't come across anything substantial yet.

As long aas you do *not* pass INTERNET_FLAG_NO_COOKIES to 'HttpOpenRequest()', it should work.
0
 
lwinkenbAuthor Commented:
I'm not passing INTERNET_FLAG_NO_COOKIES, but it still isn't working.
0
 
lwinkenbAuthor Commented:
Here is what my HttpOpenRequest looks like:

hRequest = HttpOpenRequest(hSession,NULL,"/session_login.cgi?user=root&pass=mypassword","HTTP/1.1",NULL,(const char**)mediaTypes,
            INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_CN_INVALID |
            INTERNET_FLAG_IGNORE_CERT_DATE_INVALID | INTERNET_FLAG_KEEP_CONNECTION |
            INTERNET_FLAG_NO_CACHE_WRITE | INTERNET_FLAG_NO_UI |
            INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_RELOAD,0);
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.