|
title:
Can InternetSetCookie be used to set IE cookies in VC programs?
Process and phenomenon:
(1) User name and password: use CInternetSession and CHttpConnection in wininet.lib to log in successfully.
(2) Get Cookie: InternetGetCookie( (LPCTSTR)strURL, NULL, szCookie,&dwLength ); The cookie obtained successfully is: ASP.NET_SessionId=xxxxxxx;
(3) Set Cookie: IInternetSetCookie((LPCTSTR)strURL,NULL,szCookie ); success
(4) Open IE:ShellExecute( NULL, "open", "IExplore", (LPCTSTR)strURL,NULL, SW_SHOWNORMAL); Always show "Session Expired" warning dialog box, I use HttpWatch to see if there is no (3) Cookies set in.
Questions I want to ask:
(1) Can the cookie set with IInternetSetCookie be used by IE?
(2) If so, why can't the above settings work! What is wrong? Where else should I set up?
(3) Does the above situation have anything to do with HTTP SERVER?
Thanks:
Would you please give me more advice from experienced friends! Thanks in advance! |
|