473,785 Members | 2,801 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User Authentication - LogonUserIdenti ty

Hi!

Does anyone know why it is that when I use:

Request.LogonUs erIdentity.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 5636
LogonUserIdenti ty 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.goo glegroups.com.. .
Hi!

Does anyone know why it is that when I use:

Request.LogonUs erIdentity.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:
LogonUserIdenti ty only returns a true user name if Windows Authenticationi s 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.goo glegroups.com.. .
Hi!

Does anyone know why it is that when I use:

Request.LogonUs erIdentity.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. .. -->
<authenticati on mode="windows">

<!-- For Forms Authentication. .. -->
<authenticati on 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 "machinenam e/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.goo glegroups.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:
LogonUserIdenti ty 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.goo glegroups.com.. .
Hi!

Does anyone know why it is that when I use:

Request.LogonUs erIdentity.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
3211
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 password (plain text): 1) Validate that the password is correct for that user *without actually logging in*. 2) If the password is valid, return a list of all the groups the user belongs to. Otherwise, return some error string.
4
17802
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: Web.HttpContext.Current.User.Identity.Name to write audit trail as to what users do. Now recently on one of the activities I noticed that the
5
2390
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 still didn't work. Any ideas?? 1. In IIS console, right click the virtual directory 2. click directory security tab 3. click edit button on anonymous access 4. click browse button
8
2217
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 out on my machine and had <deny users="?"/> how do I do this on the server to get the user NTLogin
15
2927
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 login id in other forms of the app. I will eventually save a record to a SQL database, and I want the login id to be automatically entered in a field on a form other than the login page. Help.
2
2158
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 separated by groups In more details I want to know if the user is administrator, users, customer service (a windows group i create) and so on. I tried using Request.LogonUserIdentity.Groups but did not result in what I want.
1
1636
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 pages/webservices HttpContext.Current.User matches the token I authenticated. However, when I perform an anonymous request I get a token for the anonymous user ("NT AUTHORITY\ANONYMOUS LOGON", S-1-5-7) and return that in GetUserToken. When asp.net gets it,...
9
15534
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 check the password. The thing is I can't access the password attribute to compare with the user's password provided.
2
2443
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 (Request.LogonUserIdentity != null) { sb.AppendFormat("Request.LogonUserIdentity AuthenticationType: {0}<br />", Request.LogonUserIdentity.AuthenticationType); .....
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10324
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10090
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9949
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8971
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6739
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.