HttpContext.Current is a static member that can be accessed anywhere in the application. https://msdn.microsoft.com/en-us/library/system.web.httpcontext.current%28v=vs.110%29.aspx Obviously, there are problems, for example, if you do not have an HttpContext when calling the code.
So, HttpContext.Current.User should work for you. I would not recommend it, because your basic data access code now depends on what should be stored on your display or controller logic, etc. It is also assumed that your data access is in the web application itself, and not in, say, an external library.
Personally, I just pass on the details, such as user ID and access time, as part of adding and changing database queries. Make the class "AuditTrail" or something else. This will allow you to reuse this data access code (always good) in another project without having to retrieve all the HttpContext materials.
Misterjo
source share