How to Get the Currently Logged in Computer User within the Web Page

I'm creating an ASP.Net web application and the requirement is that users on our intranet ( AD-LDAP authenticated ) have the option, when first browsing to the logon page, to either be logged on through their current user account automatically, or be given a chance to log on as a different user. So the Logon page needs to be able to determine who is currently logged on to the computer. How can I do this?

I have the LDAP forms-based authentication working already.

Thanks Very Much in Advance.




5/15/2008 6:48:47 PM 2291 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 0
Get it on Google Play
Get it on Apple App Store


5/15/2008 7:48:19 PM



Just after I posted I found Environment.UserName, which returns the same name as Page.User.Identity.Name.

Are these reading from the same source? Is there any difference at all?

Thanks, Curt. 


5/15/2008 8:02:37 PM

There can be a difference between the two if you use impersonation. The recommendation is to use User.Identity.Name although both is valid.

See for a description of the differences.

If this post was useful to you, please mark it as answer. Thank you!
5/18/2008 8:24:48 PM

Similar Artilces:

How to get the Windows username of the currently logged-in user to pass to Active Directory in C#
Hello to all,It's hard to explain this but I will do my best.I am building an Intranet application which needs to authenticate users off Active Directory after identifying them through their Windows login username. Below are the series of events that need to happen:1. User logs onto their Windows desktop within the company.2. The user pulls up a web browser and enters the Intranet app URL e.g. http://companyintranet3. As soon as the user hits the app the authentication module kicks in to work out who they are.This is where the business logic should work out the current user's Windows login u...

Get user guid from Active Directory user who is logged in.
I'm using the Digest authentication for windows domain servers and this works. I can get the username by using: Context.User.Identity.Name. How can I get the user Guid (and other information ? ). Thanks in advance!! You could use or you could look at which outlines how to access AD.Si Philp I got the sollution: WindowsIdentity identity = WindowsIdentity.GetCurrent();...

Web page not detecting a logged in user/user not logging in
Hey guysAs it stands, I've created two web pages within my app. One is a login page which is simply a blank page with the login control dragged on top. Within this control I redirect to my second page which contains a set of asp:Panels that are supposed to hide/display depending on which user is browsing the page.I've read several tutorials and at the moment, I've installed memberships/roles using the aspnet_regsql application. I've also used the web administration tool to create an 'administrators' role and create a user which is assigned to that role. I've also ...

Getting logged in user in Active Directory
Hi Everybody, I want to perform the following actions, can any one help in this regard: When a user is logged in to a operating system under the Active Directory, the user who have logged in and the current system name has to be saved in a table automatically by a windows service which is running in the server and connected to the Active Directory. For this I want to get either the computers and the user who logged in / the users and the computer in which they are working in. Thanks in advance....

How to get logged user from SharePoint and Active Directory?
Hi, I'm involved in the developement of a c# .net web application that is executed "inside" SharePoint. I have to obtain the current logged user to be able to get his/her groups from Active Directory. I have seen how I can obtain the groups of the user from Active Directory but I don't know how to obtain the logged user. Can anyone help me?Thanks in advance!  Since you are asking a sharepoint question on these forums ,you should not expect to fin a sharepoint experts here, Instead you can ask your sharepoint questions on these forums.

Net::LDAP, Active Directory and Disabled Users
------_=_NextPart_001_01C386CB.502F3B30 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I've been trying to write a simple perl script that will query the = active directory via LDAP and give me a list of email addresses for disabled = users (eg, addresses we don't want to accept email for anymore). I found a = website or two that suggested I use the following as my filter: (&(objectCategory=3Dperson)(userAccountControl:1.2.840.113556.1.4.803:=3D= 2)) I was beginning to think these websites were wrong as whene...

RE: Net::LDAP, Active Directory and Disabled Users
Version of Perl:=20 5.8.0 (as supplied with RedHat9) Version of Net::LDAP: [jsteenha@jake utilities]$ perl -mNet::LDAP -e 'print = "$Net::LDAP::VERSION\n"' 0.29 Relevant part of Perl code: #!/usr/bin/perl use Net::LDAP; use Net::LDAP::Filter; $filter =3D = '(&(objectCategory=3Dperson)(userAccountControl:1.2.840.113556.1.4.803:=3D= 2))'; #$filter =3D '(objectCategory=3Dperson)'; $f =3D new Net::LDAP::Filter; $f->parse($filter); $f->print(); #exit; my $ldap =3D Net::LDAP->new('acutex-dc01'); my $mesg =3D $...

Net::LDAP, Active Directory and Disabled Users #2
I've been trying to write a simple perl script that will query the active directory via LDAP and give me a list of email addresses for disabled users (eg, addresses we don't want to accept email for anymore). I found a website or two that suggested I use the following as my filter: (&(objectCategory=person)(userAccountControl:1.2.840.113556.1.4.803:=2)) I was begining to think these websites were wrong as whenever I tried this filter, I'd go no results. With other filters, I'd get the results I'd expect to get. I then tried that filter in a couple other appli...

Get current user (logged in from a special (known) workstation) from LDAP
Hi! We use netware 6.5 with latest servicepack. I'm wondering, if there is a possibility to get the account out of the ldap from an user logged in from a known client to the Netware server. Currently users accessing the intranet (loading from an debian server) have to log in with their Netware account and passwort. After checking against netware's ldap they get access. Fetching the current-user before logging in the browser we could speed up the browser-login-proecess. Having the Netware user offers us also the possibility to redirect to special ldap-group-based start...

Get reference to user web control within master page
Hi, i have a master page with contentplaceholder on itand a default.aspx page which inherit the default.aspx content i place a user web control.( on my user web control i have textbox and button-->POSTBACKURL -->result.aspx )my problem is that i cant get reference to the textbox when i clicked on the button.Please Help.      Hi,You need to access the MasterPage first using the "Master" property of the Page class. For e..g:this.Master.FindControl("uc1").FindControl("textbox1");The reason for this is due to the fact th...

Recognise (active directory) user without the need for logging into web app
 Hello I have hooked up Active Directory to my web application.It is working so that users in AD can log in/ log out ok.....This will be an app on the intranet, so what i want is that the user is recognised automatically when they log into windows.i.e they will not need to log in to the application (again) , it automatically recognises them. how can i achieve this?    check this:

Getting the user name of the currently logged in user
I'm writing my first custom module. Just as an experimental project I would just display information about the currently logged in user. I can get the User Id, but I don't know where to get the rest of the information. How do I get this? Hi, Just create a new UserController to get the information about one user via the method GetUser(PortalId, UserId) and store it into a UserInfo. Then you can get the rest of the information from this UserInfo [VB] Dim myUser As New UserInfo Dim myUserController As New UserController myUser = myUserController.GetUser(PortalId, Use...

how to get the user id of the currently logged in user?
hi,       m develoing a site whereby employees are supposed to log in and take orders.  the users are being created thru the ASP web Administration tool and stored by default into the SQL Server Database named AspNetDB.mdf that's stored in the App_Data folder of our website. the database is created auomatically. How to display the userid as this userid is too complicated and there can be many users with the same username. You can use the Membership class to get the info about a user: Membership.GetUser() The GetUser method can also take a username as a...

Active Directory LDAP Query using current windows user for AD login
I have the following AD LDAP query that gives me all of the users in a specific group, and it works just fine, however on Lines 3 and 10, how can I pass the authentication token of the current windows user (i.e. User.Identity.Name) to Active Directory so that the user viewing this web page is the one that is being authenticated in AD to query AD?  The web app uses Integrated Windows Authentication.  Anonymouse access is turned off (and cannot be turned on for security purposes).  All domain users are already able to query Active Directory.  I'm in a corporat...

Web resources about - How to Get the Currently Logged in Computer User within the Web Page -

Ohio Secretary of State Husted plans to treat Donald Trump unfairly
Ohio Secretary of State John Husted announced earlier today that, should Donald Trump decide to launch an independent bid for president, his ...

Someone edited all 6 'Star Wars' movies side by side so you can watch them at the same time
With "Star Wars: The Force Awakens" days away from its US premiere, many fans are marathoning the entire series in preparation. One fan has already ...

French Teacher Lied About ISIS Stabbing, Prosecutors Say
The authorities said the teacher was being questioned after he claimed to have been attacked at the Jean Perrin preschool in Aubervilliers, a ...

Apple Gifts Retail Employees With Apple Music Subscription
Apple last week provided all of its employees with urBeats earphones from the Beats by Dr. Dre product lineup as part of an annual holiday gift, ...

Samsung Galaxy S7 release date equals no need for USB-C speed
Today we're talking all about the Samsung Galaxy S7 and its USB connector, especially when it comes to connecting quick. When your device uses ...

Climate Change: Melting Glaciers May Cause Earth To Spin Faster
Climate change-triggered glacial melting could increase the speed of the Earth’s rotation and even shift the planet’s axis, according to new ...

Drone Registration Rules Are Announced by F.A.A.
An estimated 700,000 drones are expected to be bought during the holidays, and owners of drones weighing between a half-pound and 55 pounds must ...

Jury deliberates in first of six police homicide trials in Baltimore
Jurors started deliberations Monday in the trial of a Baltimore policeman charged, along with five fellow officers, in the death of a African-American ...

Symposium: Contraceptive mandate cases – why the Supreme Court will instruct lower federal courts to ...
John Bursch co-chairs the Appellate & Supreme Court Practice at Warner Norcross & Judd LLP. John has argued nine U.S. Supreme Court cases since ...

Bowe Bergdahl to Face Court Martial
. . . and possible life sentence

Resources last updated: 12/14/2015 11:28:55 PM