By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,533 Members | 1,497 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,533 IT Pros & Developers. It's quick & easy.

User Authentication - LogonUserIdentity

P: n/a
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

Nov 29 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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/
===================================
<ma************@gmail.comwrote in message
news:11**********************@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

Nov 29 '06 #2

P: n/a
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 Authenticationis 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/
===================================
<ma************@gmail.comwrote in message
news:11**********************@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
Nov 29 '06 #3

P: n/a
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/
===================================
<ma************@gmail.comwrote in message
news:11**********************@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/
===================================
<ma************@gmail.comwrote in message
news:11**********************@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

Nov 29 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.