locked
ASP.NET UserPrincipal not consistent when multiple people are on the site. RRS feed

  • Question

  • I have a website that is pulling in the current authenticated user using the following code.

                PrincipalContext ctx = new PrincipalContext(ContextType.Domain, "domainname");
                UserPrincipal user = UserPrincipal.FindByIdentity(ctx, HttpContext.Current.User.Identity.Name);

    I currently have it in the Session_Start of my site.  If multiple people hit the site, is gets confused and seems to get the last person to hit the page.

    Where is the best place to get the current user?  I want to display this info in the master page header of my site.

    Thanks

    Tuesday, February 27, 2018 2:57 PM

All replies

  • Hi Jeff573,

    Thank you for posting here.

    For your question is more related to ASP.NET, you could post a new thread in ASP.NET forum for suitable support.

    The CLR Forum discuss and ask questions about .NET Framework Base Classes (BCL) such as Collections, I/O, Regigistry, Globalization, Reflection. Also discuss all the other Microsoft libraries that are built on or extend the .NET Framework, including Managed Extensibility Framework (MEF), Charting Controls, CardSpace, Windows Identity Foundation (WIF), Point of Sale (POS), Transactions.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, February 28, 2018 5:59 AM