Search code examples
sessionasp.net-mvc-4cookiesiis-7.5session-cookies

Session Cookies on IIS Web Farms


I am using a jQuery plug-in to create a cookie (https://github.com/carhartl/jquery-cookie) and have been allowing the cookie to default to a "session cookie". Which is exactly the behavior I would like to have. My concern is that when I deploy my web site to Production, that it will be in a web farm on that environment. Can anyone help me understand what kind of issues, if any, that I will run into with session cookies on a web farm? The version of IIS on the web farm is IIS 7.5.


Solution

  • No issues at all. Cookies are stored on the client. They don't know or care about your server side infrastructure and how many nodes you have.

    There are 2 types of cookies:

    1. Session cookies - live only in the memory of the webbrowser and do not survive browser restart.
    2. Persistent cookies - stored as files on the file system for a specified duration and survive browser restarts.

    From the perspective of the server it makes strictly no difference. The cookie will be sent by the client on each request and the node that is serving the request will receive this cookie.

    If on the other hand you are storing some information in the memory of the web server, such as for example using ASP.NET Session with the default InProc state then you will have problems. But this has nothing to do with client side cookies.