locked
Getting the users logon ID RRS feed

  • Question

  • User-305496339 posted

    Hi friends,

    I am using the membership authentication. I was wondering what all is involved in getting a session variable as per the line of code below. For some reason I can't access the value that should be in the Session variable EmployeeID. Thanks !

    boxEmployeeID.Text = Session("EmployeeID")

    Thursday, October 3, 2019 8:56 PM

Answers

  • User61956409 posted

    Hi rkrex,

    You can refer to the following code snippet to get the current user first

    var current_User = System.Web.Security.Membership.GetUser(User.Identity.Name);

    Then you can get ProviderUserKey etc information for the user based on current_User.

    current_User.ProviderUserKey

    With Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 4, 2019 1:46 AM