Getting the current login name from SharePoint

Hi guys,

Recently I was creating a Web Part and I needed to get hold of the current login name for comparison. It was simple and didn’t require great amounts of code. Thanks you
SharePoint for making life easier.   Laughing 

string userName = SPContext.Current.Web.CurrentUser.LoginName;

Returns
domain\LoginName

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments

December 16. 2009 20:02

 insomnia cause

Intimately, the post is in reality the sweetest on this noteworthy topic. I agree with your conclusions and will thirstily look forward to your future updates. Just saying thanks will not just be enough, for the great lucidity in your writing. I will right away grab your rss feed to stay informed of any updates. Admirable work and much success in your business efforts!

insomnia cause

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



 

Dilbert of the day