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?

0
boflynn
7/18/2008 4:05:07 PM
asp.net.security 27051 articles. 1 followers. Follow

3 Replies
2966 Views

Similar Articles

[PageSpeed] 45

try this: HttpContext.Current.User.Identity.Name

0
jportelas
7/18/2008 4:15:38 PM

 Thanks - tried that...it returns nothing or domain\loginName :(

0
boflynn
7/18/2008 4:33:18 PM

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 Integrated Authentication" checkbox is checked.

Then try the last line of code I provided.

0
jportelas
7/18/2008 7:18:43 PM
Reply:

Similar Artilces:

How to get domain user's first name, last name and e-mail address
Hi everyone, I am able to retrieve the domain/user ID by setting <authentication mode="Windows"/> in the Web.config file, and with the following code in my Default.aspx.,cs page: string strName = Request.ServerVariables["AUTH_USER"]; I would also like to retrieve the users first name, last name and e-mail address from their domain profile, if possible.  Can anyone help me with a code example?  I'm somewhat new to C#/.NET/OOP so if you have it in "C# for Dummies" format, I would be very thankful! Thanks in advance for any help that i...

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

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

Groupwise user name in pace of first and last name
We meet a strange behaviour with groupwise client ( windows ) in caching mode. since we've chosen "caching mode", Return notification ( popup ) for tracking information display "groupwise username" in place of "first/last Name" Anyone experienced this case ? Thanks -- chabot49 ------------------------------------------------------------------------ chabot49, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been ...

Get user first and last name?
All  I can use the following to get my users logon name, If User.Identity.IsAuthenticated Then Label1.Text = "Welcome, <B>" + User.Identity.Name + "</B>" Label1.Text = Label1.Text & "Welcome, <B>" + Request.LogonUserIdentity.Name + "</B>" ElseResponse.Write("sorry") End If how do i now get thier first and last names thanks gibbo Plz explain  complete requirement and database Entity..?  Thanks & Regards,Murthy. I am not interacting with a database in any way, I know my us...

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

Extracting first name, last name, middle name from a string
I have a variable in a stored procedure that puts the first name, last name, and middle name in the format LastName, FirstName MiddleName. (I cannot just used the columns firstname, lastname, etc. as they are not available in the stored proc.) I am trying to split this up so that it reads LastName, [new line] ~r~n FirstName + MiddleName. Any suggestions on extracting this into that format? Any help greatly appreciated. I am working with Infomaker 6.0 and Windows 2000 Thanks, Sean Actually, it's just the format LastName, FirstName so I would only need to search for the comma an...

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

Search by first/last name or just last name?
I have a simple page that searches an access database by first and last name. How would I set it up to search by the first and last name OR just the last name.I tried this:where ([player.first_name] LIKE '%' + ? + '%') and ([player.last_name] LIKE '%' + ? + '%') or  ([player.last_name] LIKE '%' + ? + '%')but it didn't work. Thank you.  You just about got it, you just need a couple more parens, like this:where (([player.first_name] LIKE '%' + ? + '%') and ([player.last_name] LIKE '%' + ? + '%'...

[contacts] Option to display names in [Last name] [First name] order
I've come up with the image of the "Display by last name". Could you confirm UI? Bugzilla 916789 https://bugzilla.mozilla.org/show_bug.cgi?id=916789 Thanks, Teiichiro ...

Getting the user's first and last name
I'm using the login control and I'm getting the username without a problem (<asp:LoginName ID="LoginName1" runat="server" />) but how do I get the user's first and last name (or any other information)?  I do have the user's information stored in a database.  I'm not utilizing Profile schema either.Thanks. Use the MemberShip class to get the user information. http://msdn.microsoft.com/en-us/library/tw292whz.aspx*** If this post helps you, then Mark this post as Answer ***...

Question about 5.5.7.1 usernames, last name first or first name first
I have been looking through all the settings on groupwise and i am yet to find how to change the names from last name first to first name first. My account happens to say Phil Halbasch where others says Halbasch, Phil. If anyone knows of that secret setting to modify this it would be helpful. Thanks, Phil I figured it out, sorry for wasting ur time :) FYI Click Address book Click View tab and then name format "Phil Halbasch" <abc@hotmail.com> wrote in message news:FJrDb.4825$Rl1.3427@prv-forum2.provo.novell.com... > I have been looking th...

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 user's first and last name from AD
I have an intranet site running with windows authentication, and I would like to greet the user with their full name. What's the best way to find the first and last name values entered in the AD database?I guess it needs a DirectorySearcher object, but my AD knowledge stops there.Thanks,JohnJohn HogeSeaEagle.com Inflatable Boats You can get the current user's details by parsing their domain name and performing a search for it.  Here is an example - 'sn' and 'givenName' are last name and first name respectively.<%@ Assembly Name="System.DirectoryServices, Version=1.0.5000.0, Cultur...

Web resources about - Getting first name and last name from Windows logged in user - asp.net.security

Haley's response to Obama not 1st time on national stage
COLUMBIA, S.C. (AP) — After a year when a church massacre and catastrophic flooding put her in the spotlight, South Carolina Gov. Nikki Haley ...

Clinton pushing Iowa activists for maximum effort
SIOUX CITY, Iowa (AP) — Democratic front-runner Hillary Clinton is guarding against complacency as she travels along the snow-covered fields ...

Uber’s China rival Didi Kuaidi sees 1.4M requests on new test-drive service in first 90 days
Didi Kuaidi, Uber’s market-dominant leader in China, says it received 1.4 million test drive requests since launching the service in October. ...

Twitter appears ready to expand beyond 140-character tweets
SAN FRANCISCO (AP) — Twitter appears ready to loosen its decade-old restriction on the length of messages in a bid to make its service more appealing ...

Q&A: A look at Netflix's documentary 'Making of a Murderer'
MILWAUKEE (AP) — An online petition has collected hundreds of thousands of digital signatures seeking a pardon for a pair of convicted killers-turned-social ...

Hasbro is adding Rey to Star Wars Monopoly after criticism from fans
Rey is coming to Star Wars Monopoly, toymaker Hasbro confirmed, after the company received sustained criticism for excluding her from its latest ...

Trevor Noah Mocks Fox News' New Year's Eve
We weren't the only ones who took note of Donald Trump getting his own Fox News New Year's Eve countdown. The Daily Show did, too, and it was ...

Saudi Arabia's Fragile State
WASHINGTON "Fragile" is the word that journalist Karen Elliott House used to describe Saudi Arabia in her 2012 book about the country. "Observing ...

Siddhartha Dhar was arrested before joining ISIS in Syria
Siddhartha Dhar, 32, was arrested in September 2014 and order to surrender his passport. But police only realised he had absconded when they ...

Ronda Rousey Will Need More Than A Win Over Holly Holm To Restore Her Legitimacy
Ronda Rousey, by her own admission in an interview reported by ABC News , is still reeling from her loss at UFC 193 to Women’s Bantamweight Champion ...

Resources last updated: 1/6/2016 10:00:47 AM