a request level singleton object in asp.net
问题 I trying to write a kind of pseudo singleton implementation. I want it to work similar to how HttpContext does work, where I can get an instance to the context doing something as simple as: var ctx = HttpContext.Current; So my implementation goes something like this: public class AppUser { public string Username { get; set; } public string[] Roles { get; set; } public AppUser() { var appuser = HttpContext.Session["AppUser"] as AppUser; if(appuser == null) throw new Exception("User session has