title: ASP.NET cookies doesn't appear to be set when on IIS
body: <p>I have an rather simple ASP.NET application that sets a cookie (actually 2) after a user has logged in.
  This all works fine in any browser (I tested with IE, Chrome and Firefox) when I'm on my local machine running the app from VS2015 (aka IIS Express).
  I can read the cookie as expected and I can also check the browser cookie collection and see that my cookie is there.</p>
  
  <p>However, when I publish my project and bring it to a remote IIS (8.5 I believe, Windows Server 2012 R2) it doesn't work anymore.</p>
  
  <p>I would provide some further information if only I knew what to provide - I have no idea what would be of interest in this regard for anyone trying to help me out - so I'm aware that I probably need to provide some extra information, I just don't know what :)</p>
  
  <p>Please let me know how I can help you help me (and whoever might have the same issue).</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I didn't add the cookie code because it appears to be working (at least on my local IIS Express), but maybe I should be setting more of the cookie attributes for it to work on the remote IIS as well?</p>
  
  <p><strong>Setting the cookie</strong></p>
  
  <pre><code>HttpCookie cookie_cusr = new HttpCookie("app_portal_cusr", JsonConvert.SerializeObject(cusr));
  cookie_cusr.Expires = DateTime.Now.AddYears(30);
  context.Response.Cookies.Add(cookie_cusr);
  </code></pre>
  
  <p><strong>Reading the cookie</strong> (ClientUser is a custom class)</p>
  
  <pre><code>ClientUser cu = JsonConvert.DeserializeObject&lt;ClientUser&gt;(Request.Cookies["app_portal_cusr"].Value);
  </code></pre>
  
  <p>The application doesn't throw any exceptions - the cookie is just not set as in, it doesn't exist when i check the browser cookie collection and also when my code tries to read it (I check for NULL or it would actually throw an exception I assume).</p>