Get the current logged in user name

I

Imran Aziz

Hello All,
I am new to .net. I want to use windows authentication to authenticate
against the current logged in user on the client machine. I believe by using
windows authentication method, the IIS will send me details of the current
logged in user at the client machine if integrated windows authentication is
enabled at IIS. Can anyone please guide me how I can get the name of the
current logged in client that is making a request to my ASP.net application
?

I am trying to look into System.Web.Security class for this but have not
been able to find a piece of code or guidance of how to do it.

Imran.
 
I

Imran Aziz

I cannot seem to find the container class for this property.

It surly is not the member of System.Web.Security or am I wrong?

Imran.
 
B

Brock Allen

This was in the context of a Control or the Page. Another way is to call:

HttpContext.Current.User.Identity.Name
 
I

Imran Aziz

Brock thanks a lot for that, it does give me the login name along with the
domain prefix.
Thanks.
 
J

Jim in Arizona

Imran Aziz said:
Hello All,
I am new to .net. I want to use windows authentication to authenticate
against the current logged in user on the client machine. I believe by
using windows authentication method, the IIS will send me details of the
current logged in user at the client machine if integrated windows
authentication is enabled at IIS. Can anyone please guide me how I can get
the name of the current logged in client that is making a request to my
ASP.net application ?

I am trying to look into System.Web.Security class for this but have not
been able to find a piece of code or guidance of how to do it.

Imran.

I used this in my ASP pages and still use it in ASP.NET although there's
obviously many other was to achieve the same/similar result.

Dim strWho as String
strWho = Request.ServerVariables("AUTH_USER")
or
strWho = Request.ServerVariables("LOGON_USER")

HTH,
Jim
 
P

Pat

Yeah it would give the Domain prefix like DOMAIN\Username.
If you are authenticated in the domain.Whan you can do is to remove the
Domain prefix if you don't need it.
Patrick
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top