SessionCookies Property (.NET)

 

Type: Boolean

 

Returns True if the visitor has session cookies enabled, False if their session cookies have been disabled.

Session Vs. Persistent cookies with IE 5.0 and higher

For users with IE 5.0 and higher, BrowserHawk can also detect the difference between disabled session cookies Vs. disabled persistent cookies. Session cookies are cookies that are destroyed when the browser is closed. Persistent cookies are cookies that are stored on the user’s machine for a period of time as set by the cookie.

 

To check for disabled session cookies, pass in "cookie_sess" to GetExtendedBrowser or AddProperties prior when calling GetExtendedBrowser. To check for both disabled session and persistent cookies, pass in "cookie_sess, cookie_perm".

 

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".

Cookie detection for non-IE 5.0 and higher

With IE versions prior to 5.0, and any version of Netscape and Opera browsers, there is no difference between disabled session Vs. persistent cookies. This is because IE 5.0 and higher are the only browsers that allow enabled/disabled status to be set differently for each cookie type. Therefore it is irrelevant whether you pass in "cookie_sess" or "cookie_perm" for this check (or "cookie_both") because BrowserHawk will check the browser the same way. In this case all the various cookie check options are synonymous.

 

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 Session cookie status and not Persistent cookies:

<%

ExtendedOptions options = new ExtendedOptions();

options.AddProperties("cookie_sess");

ExtendedBrowserObj extBrow = BrowserObj.GetExtendedBrowser(options);

%>

<html>

Session cookies: <% Response.Write(extBrow.SessionCookies); %>

</html>

 

C# Example 2 – If interested in both Session and Persistent 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:

PersistentCookies Property (.NET)

CookieDuration Property (.NET)

WebStorageEnabled Property (.NET)