Hi @BeUnique ,
i am getting error in the below line.
var tokens = fullName.Split('\', 2);
2 is not necessary, so you can remove it and it won't affect the domain nad userName.
I also test your initial code, it works well. How did you know the error caused by it, did YSOD return that? Can you show the error page? What's your environment and IIS or application configuration?
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Bruce Zhang