Hi Guys
I'm doing an ASP.NET MVC application and some of my Action Methods and other Extension Methods need access to User data. The code I'm using to get the user is:
this.currentUser = (CurrentUser)HttpContext.Session["CurrentUser"];
//and in the extension methods it's:
CurrentUser user = (CurrentUser)HttpContext.Current.Session["CurrentUser"];
This same line is scattered among a lot of my Action Methods in a lot of my Controllers. The problem is this makes it difficult to test, and it doesn't appear to be very 'elegant'.
can anyone suggest a good SOLID approach to this solution?
Thanks
Dave