PersistentCookies Property (.NET)

 

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:

 

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)

CookieDuration Property (.NET)

WebStorageEnabled Property (.NET)