Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   User Authentication - LogonUserIdentity (http://www.velocityreviews.com/forums/t383174-user-authentication-logonuseridentity.html)

mario.colorado@gmail.com 11-29-2006 01:02 AM

User Authentication - LogonUserIdentity
 
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


Juan T. Llibre 11-29-2006 01:26 AM

Re: User Authentication - LogonUserIdentity
 
LogonUserIdentity only returns a true user name if Windows Authentication is used.

http://msdn2.microsoft.com/en-us/lib...ridentity.aspx



Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
<mario.colorado@gmail.com> wrote in message
news:1164762120.638965.242700@l12g2000cwl.googlegr oups.com...
> 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
>




mario.colorado@gmail.com 11-29-2006 01:49 AM

Re: User Authentication - LogonUserIdentity
 
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.


Juan T. Llibre wrote:
> LogonUserIdentity only returns a true user name if Windows Authentication is used.
>
> http://msdn2.microsoft.com/en-us/lib...ridentity.aspx
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> <mario.colorado@gmail.com> wrote in message
> news:1164762120.638965.242700@l12g2000cwl.googlegr oups.com...
> > 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
> >



Juan T. Llibre 11-29-2006 11:47 AM

Re: User Authentication - LogonUserIdentity
 
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/de...onprovider.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...;EN-US;Q306158

General info on ASP.NET Authenticatoin is at :
http://msdn.microsoft.com/library/de...onprovider.asp

There's a step-by-step guide to ASP.NET Web Application Security at :
http://msdn.microsoft.com/library/de...onsecurity.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.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
<mario.colorado@gmail.com> wrote in message
news:1164764962.423045.243370@n67g2000cwd.googlegr oups.com...
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.


Juan T. Llibre wrote:
> LogonUserIdentity only returns a true user name if Windows Authentication is used.
>
> http://msdn2.microsoft.com/en-us/lib...ridentity.aspx
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> <mario.colorado@gmail.com> wrote in message
> news:1164762120.638965.242700@l12g2000cwl.googlegr oups.com...
> > 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
> >





All times are GMT. The time now is 09:36 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57