title: static class instances unique to a request or a server in ASP.NET?
body: <pre><code> public sealed class UserLoginSingleton
  {
  
       UserLoginCollection _userLoginCol = new UserLoginCollection();
  
      UserLoginSingleton()
      {
      }
  
      public static UserLoginSingleton Instance
      {
          get
          {
              IDictionary items = HttpContext.Current.Items;
              if (!items.Contains("TheInstance"))
              {
                  items["TheInstance"] = new UserLoginSingleton();
  
              }
              return items["TheInstance"] as UserLoginSingleton;
          }
      }
  
  
      public void CreateUserObj(string xmlData)
      {
          _userLoginCol = (UserLoginCollection)_xmlUtil.Deserialize(xmlData, typeof(UserLoginCollection));
      }
  
      public UserLoginCollection getUserObj()
      {
          return _userLoginCol;
      }
  }
  </code></pre>
  
  <p>Usage:</p>
  
  <p>Page 1.aspx</p>
  
  <pre><code>UserLoginSingleton.Instance.CreateUserObj(xml);
  </code></pre>
  
  <p>Pase2.aspx:</p>
  
  <blockquote>
    <p>UserLoginCollection
    userLoginCollection =
    UserLoginSingleton.Instance.getUserObj();</p>
  </blockquote>
  
  <p>Followed the article here:
  <a href="https://stackoverflow.com/questions/194999/are-static-class-instances-unique-to-a-request-or-a-server-in-aspnet">link text</a></p>
  
  <p>I set my collection object in page 1 and then do a response.redirect or click on link to get me to page 2.aspx. However, my singleton instance has no collection object i set. How do i persist my collection object across diff pages per each session?</p>
  
  <p>I know static's wont work as every instance will see the object and i want that to specific per each user.</p>