• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

How can I get the ucrrently login userid and the password?

Thanks.
0
lapucca
Asked:
lapucca
  • 3
1 Solution
 
ozymandiasCommented:
You can't get the password.
The method of getting the curretly logged in userid depends on the context.
Is this a winforms app or an asp.net app ?
0
 
ozymandiasCommented:
ASP.NET
WindowsIdentity Identity = (WindowsIdentity)HttpContext.Current.User.Identity;

Otherwise, try :

WindowsIdentity Identity = WindowsIdentity.GetCurrent();

Then you can do Identity.Name to get the username.
0
 
lapuccaAuthor Commented:
Sorry, I'm using vs2005, .net 2.0 running on Win2k and up.  The application is a winForm appl.  Thanks.
0
 
ozymandiasCommented:
OK. Try :

WindowsIdentity Identity = WindowsIdentity.GetCurrent();
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now