troubleshooting Question

Retrieving Username in

Avatar of bobbellows
bobbellows asked on
5 Comments1 Solution683 ViewsLast Modified:
Dear Experts,

I am new to coding in C# and to the open source blog engine called blogengine. I wanted to retrieve the logged in user name when a page loads. On the code behind of the "Page" file i placed the following code:

        string username = System.Security.Principal.WindowsIdentity.GetCurrent().User;

I received the following error:

Cannot implicitly convert type 'System.Security.Principal.SecurityIdentifier' to 'string'

 Can you tell me what I need to do to get this simple task done? I thought for sure the "User" would be a string value.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros