Link to home
Start Free TrialLog in
Avatar of lwinkenb
lwinkenb

asked on

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?
Avatar of jkr
jkr
Flag of Germany image

Check your IE settings, if they are set to not allow cookies, that will affect Wininet, too.
Avatar of lwinkenb
lwinkenb

ASKER

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.
>>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.
I'm not passing INTERNET_FLAG_NO_COOKIES, but it still isn't working.
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);
ASKER CERTIFIED SOLUTION
Avatar of ee_ai_construct
ee_ai_construct
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial