473,326 Members | 2,192 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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

Nov 29 '06 #1
3 5597
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim Daneliuk | last post by:
OK, I've Googled for this and cannot seem to quite find what I need. So, I turn to the Gentle Geniuses here for help. Here is what I need to do from within a script: Given a username and a...
4
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: ...
5
by: Matthew Louden | last post by:
I wrote ASP.NET application that access SQL Server database. When I run the application, it yields "Login failed for user '<COMPUTER_NAME>\ASPNET'" error message. I then did the following, but...
8
by: Joe | last post by:
I check for the NTLogin of a user by Page.User.Identity.Name, but when I put the app on the server the value for Page.User.Identity.Name is "" I had the <allow users="*/> attribute commented...
15
by: Tom Nowak | last post by:
I am writing a webapp in which a user is required to enter a login id and password on a login form. I have forms authenticaion coded in my web.config. Once the user is logged in, I want to use the...
2
by: Jr. BTS dev! | last post by:
Hello all, In my web app I want to authenticate users using the Windows NT user Groups they blong to. The app will be used internally. Users will all belong to the same domain Users are...
1
by: Eric Pearson | last post by:
I implement my own HTTP server and pass ASP.Net requests via HttpWorkerRequest. When I authenticate a client, I pass the correct windows token inside of GetUserToken(), and within my...
9
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
2
by: WT | last post by:
Hello, I tryed to fix a variable with the current authentication mode, I tryed to use Request.LogonUserIdentity AuthenticationType for this but when I traced with this code if...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.