Sign up ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to get current user in high-trust apps at sharepoint 2013 on-premises environment. But each returned user are the same, how can i get the correct current user? Here is my code:

    public ActionResult Index()
        var sharepointUrl = Request.QueryString["SPHostUrl"];

        var clientContext = TokenHelper.GetS2SClientContextWithWindowsIdentity(new Uri(
            sharepointUrl), Request.LogonUserIdentity);

        clientContext.Load(clientContext.Web.CurrentUser, user => user.LoginName);


        string result = "<h2>Web title retrieved using the managed client object model</h2>";
        result += "<p>" + clientContext.Web.Title + "</p>";


        ViewBag.Content = result;
        ViewBag.User = string.Format("Current UserName:{0}", clientContext.Web.CurrentUser.LoginName);

        return View();
share|improve this question

1 Answer 1

You need to enable "Pass-through authentication" in your IIS website. Follow the steps described in the following page Windows Authenticated logon configuration for Microsoft IIS7

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.