Type: Boolean
Returns True if the visitor has persistent cookies enabled, False if their session cookies have been disabled.
To check for disabled persistent cookies, pass in "cookie_perm" to GetExtendedBrowser or AddProperties prior to calling GetExtendedBrowser. If the user has persistent cookies disabled, the CookiesEnabled property will be set to False regardless of whether session cookies are enabled. To check for both disabled session and persistent cookies, pass in "cookie_sess, cookie_perm".
See the SessionCookies Property (.NET) for a discussion about detecting disabled session cookies Vs. persistent cookies.
Note: Use of this property requires the Professional or Enterprise Edition of BrowserHawk.
Special notes for this property:
If you have a load balanced web farm you must set the CookieDomain property to your root domain (i.e. "mycompany.com") prior to calling GetExtPropertiesEx. Otherwise BrowserHawk will detect cookies as being disabled, even if enabled.
When testing your code to ensure the cookie detection works as you have applied it to your site, you will likely be switching your browser back and forth from accepting to rejecting cookies. Each time you change your settings, be sure to delete your cookies, clear your history, close your browser, and reopen it. While this is obviously not needed for detection in the "real world", you may experience inconsistent testing results otherwise due to previous tests.
When checking for disabled cookies, BrowserHawk first checks to see if the browser is even capable of supporting cookies in the first place, before testing whether they are enabled or not. This way code execution is efficient as possible, and there is no need for you to perform this checking on your own before calling this method. Likewise there is no longer a need to check the BrowserHawk Cookies property, since that property only indicates whether a browser is capable of supporting cookies and not whether they are disabled.
C# Example 1 – If interested only in Persistent cookie status and not Session cookies:
<%
ExtendedOptions options = new ExtendedOptions();
options.AddProperties("cookie_perm");
ExtendedBrowserObj extBrow = BrowserObj.GetExtendedBrowser(options);
%>
<html>
Persistent cookies: <% Response.Write(extBrow.PersistentCookies); %>
</html>
C# Example 2 – If interested in both Persistent and Session cookies status:
<%
ExtendedOptions options = new ExtendedOptions();
options.AddProperties("cookie_both");
ExtendedBrowserObj extBrow = BrowserObj.GetExtendedBrowser(options);
%>
<html>
Session cookies: <% Response.Write(extBrow.SessionCookies); %> <br>
Persistent cookies: <% Response.Write(extBrow.PersistentCookies); %> <br>
</html>
TIP: See the cookies.aspx sample included with your installation for more information.
See Also:
SessionCookies Property (.NET)