![]() |
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 |
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 > |
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 > > |
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.