CookieDomain Property (.NET)

 

If your web site is load balanced across multiple web servers, and it is possible that a different web server will respond to any request from the same browser, you must set the CookieDomain property to ensure proper detection by BrowserHawk.

 

Note: The CookieDomain property is only required if you are running a web farm with load balanced servers. If you are not you can disregard this section.

 

Certain BrowserHawk features require that a temporary cookie be sent to the client browser. In particular, the test for disabled cookies and the session cookie approach used by requestType 1 of the GetExtendedBrowser method require this.

 

To make sure this cookie works as expected, it is necessary in a load-balanced environment that the CookieDomain be set to the root domain shared by all web servers in your farm.

 

For this example, assume you have three load balanced web servers. To the outside the domain looks like www.mycompany.com. Also assume that internally requests to that domain are routed to www1.mycompany.com, www2.mycompany.com, and ww3.mycompany.com. In this situation you need to set the CookieDomain property to "mycompany.com". This effectively sets the Domain property of the cookie.

 

Note: You must set the CookieDomain property prior to calling the GetExtendedBrowser method.

 

Important note: To work around a Netscape oddity it is important to place a period proceeding your domain name when setting this property value. For example, use ".mycompany.com" instead of "mycompany.com".

 

C# Example:

<%

ExtendedOptions options = new ExtendedOptions();

options.AddProperties("JavaScriptEnabled");

options.CookieDomain = ".mycompany.com";

ExtendedBrowserObj extBrow = BrowserObj.GetExtendedBrowser(options);

%>

<html>

JavaScriptEnabled: <% Response.Write(extBrow.JavaScriptEnabled); %>

</html>

 

See Also:

SessionCookies Property (.NET)

PersistentCookies Property (.NET)