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?
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?
Check your IE settings, if they are set to not allow cookies, that will affect Wininet, too.
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.
- 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.
As long aas you do *not* pass INTERNET_FLAG_NO_COOKIES to 'HttpOpenRequest()', it should work.
ASKER
I'm not passing INTERNET_FLAG_NO_COOKIES, but it still isn't working.
ASKER
Here is what my HttpOpenRequest looks like:
hRequest = HttpOpenRequest(hSession,N ULL,"/sess ion_login. cgi?user=r oot&pass=m ypassword" ,"HTTP/1.1 ",NULL,(co nst char**)mediaTypes,
INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_ CN_INVALID |
INTERNET_FLAG_IGNORE_CERT_ DATE_INVAL ID | INTERNET_FLAG_KEEP_CONNECT ION |
INTERNET_FLAG_NO_CACHE_WRI TE | INTERNET_FLAG_NO_UI |
INTERNET_FLAG_PRAGMA_NOCAC HE | INTERNET_FLAG_RELOAD,0);
hRequest = HttpOpenRequest(hSession,N
INTERNET_FLAG_SECURE | INTERNET_FLAG_IGNORE_CERT_
INTERNET_FLAG_IGNORE_CERT_
INTERNET_FLAG_NO_CACHE_WRI
INTERNET_FLAG_PRAGMA_NOCAC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.