Differences in detecting disabled cookies


In the ActiveX version of BrowserHawk, disabled cookies are detected via the CookiesEnabled properties. To tell BrowserHawk whether you want to test for disabled session cookies, disabled persistent cookies, or both, you set the CookieCheckType property prior to calling GetExtPropertiesEx. Then if CookiesEnabled returns false, you can check the value of the CookieCheckType property to determine whether the return result is false because of session, persistent, or both cookie types being disabled.


With the native .NET version of BrowserHawk, detection of disabled cookies is much cleaner and more intuitive. There is no CookiesEnabled property or CookieCheckType property. Instead there are two new properties called SessionCookies and PersistentCookies.


To detect disabled cookies in the .NET version, you first call AddProperties with "cookie_sess" if you are only interested in session cookies, "cookie_perm" if you are only interested in persistent cookies, or "cookie_both" if you are interested in both session and persistent cookies. You then check the return result of the SessionCookies and/or PersistentCookies properties respectively.


See the cookies.aspx sample for a working example of detecting disabled cookies with the native .NET version of BrowserHawk.


See Also:

About the Migrating From ActiveX to .NET Guide