Windows NT Authentication

C

Cheeku

Hi,

I'm developing windows application and I want to use integrated windows
authentication in my application. I do not want to use a windows form
for entering username and domain details. I want to get the currently
logged in user details from my application.

Can you please guide me the way to fetch currently logged in user
details.

Thanks,
Cheeku
 
K

Kris

Hi,

Import following namespaces

using System.Security;
using System.Security.Principal;

and below code to get the domain and username

WindowsPrincipal wp = (WindowsPrincipal) Thread.CurrentPrincipal;
String result = wp.Identity.Name.ToString();

hope this would help you.

Cheers,
Kris
 

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