title: MVC 5 session and/or caching data
body: <p>I am coding an MVC 5 internet application and when a user logs in, I wish to store the log in details so that I can retrieve these details in any class.</p>
  
  <p>I have done some research, and I can either cache the data, or store this data in a session. Because the data is only set when the user logs in, and is only relevant to the logged in user, I believe that I should use the following code:</p>
  
  <pre><code>Session[key] = data;
  </code></pre>
  
  <p>What are the disadvantages or using the above code? Is there a timeout for this session data, or does it persist until the user closes the browser and/or logs out?</p>
  
  <p>The other option is to use the following code:</p>
  
  <pre><code>System.Web.HttpRuntime.Cache[key] = data;
  </code></pre>
  
  <p>Are there any advantages that I should consider when using the above code? I am currently leaning towards using the <code>Session[key] = data</code>, as the data is only relevant to the logged in user, and is not application wide.</p>
  
  <p>Thanks in advance.</p>