How to get name of sharepoint user

D

dsen.25

Hi

I am trying to get the logged in user name: If I use
"System.Environment.UserName" in my C#.net code I get the person's id
who logged into the machine. I want to get the name of the SharePoint
User.
From the Form Library an infopath form is filled. People get to the
form library with a specified UserId password, it does not have to be
the same as the machine logged in UserID. So when I try to use
"System.Security.Principal.WindowsIdentity.GetCurrent().Name" hoping
it will
give me the sharepoint user - I get the System Access Denied. I
actually got
the same for the System.Environment.UserName - and as soon as i added
the
site to Local Intranet zone - it worked. But for the
System.Security.Principal.WindowsIdentity.GetCurrent().Name I still
get the
error. I have few lines of code on the "OnLoad" event.
How can I make this code fully trusted? Can I just make the code fully
trusted and
not the form? If I do so will it solve this issue?

Thanks

Senthil Kumar D
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top