How to Use the InternetGetCookie() Function to Retrieve Local Cookies (306354)



The information in this article applies to:

  • Microsoft Internet Explorer 5.5 for Windows 2000 SP 1
  • Microsoft Internet Explorer 5.5 for Windows 2000 SP 2
  • Microsoft Internet Explorer 5.01 for Windows 2000 SP 1
  • Microsoft Internet Explorer 5.01 for Windows 2000 SP 2
  • Microsoft Internet Explorer 5.0 for Windows 2000

This article was previously published under Q306354

SYMPTOMS

When you call the Win32 Wininet InternetGetCookie function to retrieve a cookie that was created from a locally run HTML page, the function does not retrieve the cookie that was requested.

CAUSE

When it references the local HTML page, the temporary Internet files cache in Internet Explorer indicates that the path to the local HTML page is referenced as "~~local~~". This reference is simply a marker to indicate that that content exists in the My Computer security zone. If the InternetGetCookie function is called by passing in the "~~local~~" reference, the function does not find the cookie because the folder does not physically exist on the local computer.

RESOLUTION

When you call the InternetGetCookie function to retrieve a cookie with the "~~local~~" reference, the lpszUrlName parameter should contain the path by using the FILE:// method. For example, to retrieve a cookie that is referenced within the cache as "~~local~~/C:\test\testing" the lpszUrlName parameter should be initialized to "file:///C:\\test\\testing" before calling the InternetGetCookie function.

Modification Type:MajorLast Reviewed:11/26/2003
Keywords:kbenv kbprb KB306354