User Authentication - LogonUserIdentity

M

mario.colorado

Hi!

Does anyone know why it is that when I use:

Request.LogonUserIdentity.User.ToString()

I get something like:

S-1-5-21-2268419..........

I was expecting to get the username of the person looking at the page.
Is it possible to convert the output I get to the username such as
john_smith



Thanks!

MC
 
M

mario.colorado

Thanks! I tried it and now I get the machinename/defaultusername for
the PC I'm running the IIS in. Is this normal?

I thought I would get my domain/username, since i'm viewing the page
from a different PC.
 
J

Juan T. Llibre

re:
now I get the machinename/defaultusername for the PC I'm running the IIS in.
Is this normal?

Are you sure you enabled Windows Authentication ?

http://aspnet.4guysfromrolla.com/articles/031204-1.aspx

The method of authentication to use is specified in the Web application's Web.config file:

<!-- For Windows Authentication... -->
<authentication mode="windows">

<!-- For Forms Authentication... -->
<authentication mode="forms">

The only form of authentication which will return individual user names is Windows Authentication.

More info on Windows Authentication is found here:
http://msdn.microsoft.com/library/d...tml/cpconthewindowsauthenticationprovider.asp

If you are getting "machinename/defaultusername", you are impersonating that identity.

For code examples showing how to implement impersonation in an ASP.NET application, see:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q306158

General info on ASP.NET Authenticatoin is at :
http://msdn.microsoft.com/library/d...tml/cpconthewindowsauthenticationprovider.asp

There's a step-by-step guide to ASP.NET Web Application Security at :
http://msdn.microsoft.com/library/d...de/html/cpconaspnetwebapplicationsecurity.asp

re:
I thought I would get my domain/username

The only way you could get "domain/anyusername"
is if users of your app are challenged for credentials.





Thanks! I tried it and now I get the machinename/defaultusername for
the PC I'm running the IIS in. Is this normal?

I thought I would get my domain/username, since i'm viewing the page
from a different PC.
 

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,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top