public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); } protected void Application_AuthenticateRequest(object sender, EventArgs e) { var principalService = DependencyResolver.Current.GetService<IPrincipalService>(); // always null var context = DependencyResolver.Current.GetService<HttpContextBase>(); // always null // Set the HttpContext's User to our IPrincipal context.User = principalService.GetCurrent(); } }
public static void RegisterTypes(IUnityContainer container) { container .RegisterType<IPrincipalService, MuchoSupportPrincipalService>(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)