What is the nicest pattern you have seen or used for accessing the current logged on user in an Asp.NET application?
Current user refers to the business object that represents a user in your system, be it a membership user object or a custom class. The user object should be easy to reach within places like global (httpapplication object), web forms, controllers, webhandlers etc. It is probably be sent to the back end layers of the project and sometimes injected in other business objects depending on your application.
Requirements:
- Working nicely in both MVC and WebForms.
- The pattern should be able to work with either aspnet membership classes or own classes being "users".
- Clear and obvious way of dealing with when not being logged in.