Search code examples
asp.net-mvcentity-framework-5asp.net-mvc-5httpcontext

MVC 5 HttpContext.User in data project


I have a Solution with three projects organized like this:

Data(entity framework) -> Service -> Web (MVC).

How can i get current loget User in my Data project from HttpContext in Controller? I need to set columns in DB like CreatedBy and ModifiedBy then creating/editng item. (authentication mode is "forms")

Thanks for advice.


Solution

  • Ok, i found the solution. I have created a base Service class where added constructor with User parameter and then assigned to all Services the my base Service class.