Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Deane 14 posts 54 karma points
    May 20, 2019 @ 17:16
    Deane
    0

    How can I get the IPrincipal for an Umbraco BackOffice user?

    I'd like to manually assign the user for the current request from code.

    For instance, consider an anonymous inbound request. If I caught that early in the lifecycle (like, BeginRequest via an HttpModule), I want to manually set the user as desired, like:

    HttpContext.Current.User = GetDesiredUmbracoUser("foo");
    

    I have done this in other systems, so I know it's possible from a ASP.NET standpoint, but I'm struggling with how to get the IPrincipal in Umbraco to assign to HttpContext.Current.User.

    Again, the code above will work if I can just get a valid IPrincipal from Umbraco.

Please Sign in or register to post replies

Write your reply to:

Draft