none
Why do i get i:0#.w|domain\\username through PeopleEditor.Commaseparatedaccounts? RRS feed

  • Question

  • When i do

    Console.WriteLine(SPContext.Current.Web.CurrentUser.LoginName);

    i get the following response:

    i:0#.w|domain\\username

    When i do

    SPSecurity.RunWithElevatedPrivileges(delegate() {    Console.WriteLine(SPContext.Current.Web.CurrentUser.LoginName);});

    i get

    domain\appPoolAccount

    without i:0#.w|... within the loginname.

    Is someone able to explain why this happens?

    Also i have tested this morning the same code on SP 2010 and there does this not happen. I always get "domain\user". Is this specific to SP 2013?
    • Edited by BOG's Lab Monday, April 18, 2016 4:58 AM
    Sunday, April 17, 2016 2:30 PM

All replies

  • Hi,

    For this issue, I need to verify the things below with you:

    1. Did you run the two codes in the same web application?
    2. What authentication method is used for the web applications?

    Per my knowledge, the SPContext.Current.Web.CurrentUser.LoginName will return the user name based on the authentication method used for the web application.

    Please double check if the codes have been run in different web applications with different authentication methods.

    Best Regards,

    Victoria 


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Monday, April 18, 2016 7:23 AM
    Moderator
  • Hi Victoris,

    thanks for your reply.

    On both SP Environments i am testing the code within one WebApplication.

    That means, under SP 2013 i have one WebApplication and running the code snippets under this single WebApplication and also under SP 2010 i have one WebApplication where i am testing the code snippets.

    In SP 2013 i have under WebApplication -> Authentication Providers -> Default (Claims based) -> Claims Authentication Types ->

    v Enable Windows Authentication

        v  Integrated Windows Authentication -> NTLM

    selected.

    In SP 2010 i have under WebApplication -> Authentication Providers -> Default (Windows) -> Claims Authentication Types -> 

    v Authentication Type -> Windows

    v IIS Authentication Settings -> v Integrated Windows authentication -> NTLM

    selected.



    • Edited by BOG's Lab Monday, April 18, 2016 7:57 AM
    Monday, April 18, 2016 7:56 AM
  • Hi,

    Could you please do more test for narrowing down the issue scope?

    1. Check if the issue occurs with all the users.

    2. Check if the issue occurs with all the site collections in the web application.

    Best Regards,

    Victoria


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, April 19, 2016 9:04 AM
    Moderator
  • 1) it happens with all users

    2) it happens for all users within all sitecollections

    Tuesday, April 19, 2016 9:48 AM
  • Hi,

    Thanks for your information.

    I tested the same scenario in my environment, however the results were same for the two codes.

    I suppose that this issue may be related with environment settings or custom modifications.

    Please create a new web application and then test again to see if the issue occurs with a brand new web application.

    Best Regards,

    Victoria 


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Wednesday, April 20, 2016 6:59 AM
    Moderator