Get Windows logged in user name

Hi,

I have my own custom security module in my web application. I would like to implement signle sign on to my application. I was thinking to use mapping approach, which retrieve logged in window user name and "auto login" for him, retrieve his coressponding permission and etc.

How could I retrieve windows logged in user name?

 
Thank you  
 

0
chanmy9
11/23/2008 1:44:34 AM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
1016 Views

Similar Articles

[PageSpeed] 21

you can get the currently logged in user identity by using:

WindowsIdentity ident = System.Security.Principal.WindowsIdentity.GetCurrent();

Now you can get the prinipals properties and groups and other useful stuff like the secutiry token.



Chris Dupuy

Sr. Developer

Blue Cross/Blue Shield LA



* Please remember to click Mark as Answer on this post if it helped you *
0
exuviae
11/23/2008 3:11:38 AM

Hi,

Any settings required for IIS?

Thank you 

0
chanmy9
11/23/2008 5:27:23 AM

The default setting should be sufficient.  Check the security settings for you application and make sure only allow anonymous access is checked.  Here is a couple of sites with discussions on single signon and mixed mode authentication.

http://aspadvice.com/blogs/rjdudley/archive/2005/03/10/2561.aspx

http://aspadvice.com/blogs/rjdudley/archive/2005/03/10/2562.aspx

http://aspalliance.com/553_Mixed_Mode_Authentication



Chris Dupuy

Sr. Developer

Blue Cross/Blue Shield LA



* Please remember to click Mark as Answer on this post if it helped you *
0
exuviae
11/23/2008 5:56:58 AM
Reply:

Similar Artilces:

How to get windows log-in user name using vb.net code?
Hi, I built an asp.net web application on our companies HR system so that recruitors can post jobs. Is there a way to get the windows logged in user name using vb.net code? This user name is using for tracking who posted the job. Thank you.   Windows Authentication provides some options, as does forms authentication.  See if you get what you need through User.Identity.Name.  Take a look at: http://www.15seconds.com/issue/020220.htmhttp://aspnet.4guysfromrolla.com/articles/120705-1.aspx JeffPlease: Don't forget to click "Mark as Answer" on the p...

Getting first name and last name from Windows logged in user
 I'm sure there must be an easy way of getting the actual first name and last name from an Windows domain\username via the Windows Identity or Principal object, but I can't seem to figure it out. Does anyone have any examples of this? try this: HttpContext.Current.User.Identity.Name  Thanks - tried that...it returns nothing or domain\loginName :( Please check that on the site properties window (in IIS Admin console), in the security tab, click on the modify or edit button in the authentication and anonymous access group and make sure only the "Windows Inte...

How to get windows logged on os user name?
Hi,  In my old ASP.NET 1.1. code I have follwoing code in Page_Load of a certain page to get the os username if windows authentification checkbox is on in IIS 5.1 Session("OSUsername") = Request.ServerVariables("REMOTE_USER") Response.Redirect("subfolder2/subsubfolder3/TheSite.aspx")  Now I have migrated the code to ASP.NET 2.0 and the Server Variable REMOTE_USER is empty, although windows authentification checkbox is on !!!  How can I get OS username in ASP.NET 2.0? Background of the code above: Normally there is a logon page ...

Problem in getting logged in user Name for ASPX page with (even with this.User.Identity.Name)
Hi  friends,  I am creating an application that takes current logged in user and displays on the page itself. for this I am getting the user name in PageLoad function by using this.User.Identity.Name and then storing the value in a hidden variable for aspx page. I am using this hidden  variable to display the name of the user. I am using Windows authentication for this. Now problem that I am getting is that when multiple user launch the application from different machine and if they click simultaneously, name of one user appears on the paged displayed on the machine of ot...

How do I get the logged in user's name with windows authentication?
I have windows authentication turned on at the web server level so that it prompts for a password when the site is accessed. How do I get the username that is currently logged in? I tried using User.Identity.Name but It's just returning an empty string....

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...

Application User and still getting the logged in User Name
Hi I have a very intranet situation where User opens the Web Page Now here is calls a Database table where User Rights are stored But access to this database table is given to dbo and Application Uer which is created in IIS Server folder by clicking on Allow Anomymous Login=true when I try to run the Table Query and pass the USer Name I get null UserName how to deal with this situation   Thanks       so do you have anonymous access ON? try deny anonymous access to your application. Enable impersonation in your web.config./GuruBhai Hi, By default, ASP.N...

WINDOWS AUTHENTICATION
Hello ,I am Using windows authentication in my asp.net application. I want to know a way to get the Windows users , Group name who is logged in to my application .I mean I want to know user's group name so that role can be implimented for that group user in my asp.net application.  Thanks & Regards.Harish Patel.If you are not sure better ASK.. Because wrong guesses are COSTLY.. !!  --Harish Patel www.MicrosoftSQLandASP.netpatelharish@gmail.com I Tried with the Method Below but it does not work and give error as mentioned below : Dim test As Booleantest = User.IsInRole("G...

How to get an user name of windows when user access to web site internal
hi all, My web site used internal. I host a web site on server, How to get user name of machine that logoned and  access to this web site ? my application write in ASP.net 2.0, run on IIS 6.0I have used command below but cannot get Request.ServerVariables("LOGON_USER") thanks Here's an article that might help you. In short, you need to configure your application in IIS to use "Integrated Windows Authentication" (instead of Anonymous access) and set the authentication mode in your web.config file to Windows. Once this is done you can access ...

Get the name of user logged in
Hi Suppose i have logged into the system with my username and pwd . Iam developing a web appli in which i have get the name of the user who is currently logged into the system. How to do it????   Thanks I all depends on what kind of Auentication mode you are using. If you are using "forms" authentication you have to desing your own form to accept login credentials which you can store in Session variable and make use of it whereever required. it also gets stored in a cookie. In case of "windows" authentication, please visit these links http://msdn.microsoft....

Getting the user name when log-in.
Hi, when a user is created i have added a step that asks him to insert his name. I want to keep it in the Profile object but when i try to write it there in the CreatedUser event i get an exception telling me that unauthenticated users have no access to the Profile object. How can this be solved? Is there another way to obtain the user name and use it during the sessoin when ever this user logs in? Thanks!  Be happy. the profile of the user is not available in the CreatedUser event vai the 'Profile' object. this may help: http://p2p.wrox.com/topic.asp?TOPIC_ID=41084http:...

getting logged in user name
I have a login page with a login control.I am storing my credentials in web.config file.How do i get the logged in user name on my page?Here is what I have: protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { if (FormsAuthentication.Authenticate(Login1.UserName, Login1.Password)) { FormsAuthentication.RedirectFromLoginPage(Login1.UserName,Login1.DisplayRememberMe); Response.Redirect("Home.aspx"); } } Web.config: "Forms"> "appNameAuth" path="/" login...

get windows user name
Can anyone tell me how to pull the logged on windows username via javascript? Thanks, Steve    this is not possible in javascript but you can do it using .Net by calling the following method Request.ServerVariables("LOGON_USER") It will return a string containing the windows username. However it will only work if IIS is setup to use windows logins and you are running the ASP.Net site on an intranet and not on the internet. Please Remember to click "Mark as Answer" on this post if it helped you. -------------------http://www.crazycoder.co.ukG...

How do I get the name of the user logged in on the client
I'm working on an intranet app. I need to get the username on the client in order to display personal stuff. How do I do this?? David LeggDave Legg NOTE: The Intranet app is hosted on the same computer as that is the only computer. David LeggDave Legg Check the server variables connected to the request object. One of them (I think USERNAME or something - look it up) has the name of the logged on user. WHEN the IIS is configured in such a way that it actually retrieves the user's name.Thomas TomiczekPowerNodes ApS(Microsoft MVP C#/.NET)---Building a Website? Try the PowerNodes CM...

Web resources about - Get Windows logged in user name - asp.net.security

Window - Wikipedia, the free encyclopedia
This article is about the part of a building. For the Microsoft operating system, see Microsoft Windows . For other uses, see Window (disambiguation) ...

Microsoft Windows Information, Solutions, Tools - Windows IT Pro
Microsoft Windows information and solutions for IT pros. Topics include cloud computing, Windows Server, Exchange, Outlook, PowerShell, virtualization, ...

The Windows Blog
The Windows Blog is Microsoft's Official Blog for the Windows Operating System.

Microsoft updates Windows on phones without carriers screwing it up
The Lumia 950 , and its larger sibling, the Lumia 950XL, have just received a software update, taking them from Windows 10 Mobile build 10586.0 ...

How to enable Potentially Unwanted Application protection in Windows 8 and Windows 10
... Potentially Unwanted Applications (PUA). PUA is a broad term that covers everything from adware to browser extensions, and users of Windows ...

Detroit's window is open: Jordan Zimmermann fits the 'win-now' timeline
... for both sides and greatly helps a Detroit team that finished in the basement of the American League Central capitalize on a short-term window. ...

The research firm that once thought Microsoft would beat the iPhone has given up on Windows Phone
Back in 2011, venerable research firm IDC made some waves by predicting that Microsoft's Windows Phone would pass Apple's iOS in market share ...

Microsoft brings Windows 10 to budget-priced Lumia 550
It's not the first Lumia smartphone to adopt Microsoft's new operating system, but the 550 is the lowest-cost one so far.

Microsoft to change Windows Server 2016 licensing rules, will use per-core metric
Microsoft last week announced it will switch the licensing for next year's Windows Server 2016 to a per-processor-core basis, a move analysts ...

Microsoft's Lumia 550 Budget Windows 10 Phone Officially Launches
Selling for just under $140, Microsoft's Lumia 550 smartphone is a 4G LTE-compatible handset that offers built-in mobile Office.

Resources last updated: 12/9/2015 9:44:36 AM