Solved

How to get current user's name?

Posted on 2014-12-20
7
281 Views
Last Modified: 2014-12-21
Hi, I'm using vs2012, C# and asp.net.
why I'm getting"" with this User.Identity.Name; in my code in my C# program. I was hoping to be able to get user id/name of their window's login.  How can I get a user's name/credential whey they are visiting my web page?

Thank you.
0
Comment
Question by:lapucca
7 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 40511363
You can only do that if you have a 'login' for your pages.  Normal visitors that do not have to login do not leave any personal info that you can get.
0
 
LVL 12

Expert Comment

by:Ammar Gaffar
ID: 40511366
If your asp.net is internet based (Hosted in Internet and visitors don't have to login to access it) then you can't, but if your asp.net application is intranet based (Hosted inside your company and using your company AD - Windows Authentication) then you can.
0
 

Author Comment

by:lapucca
ID: 40511369
This will be an Intranet.  I'm still developing it and is running from my VS2012 on my PC.  Why am I just getting ""?  How can I get my id /name to display?  I am logon to our company network VPN using Cisco Anyconnect right now.  
Thank you.
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 200 total points
ID: 40511375
in your authorization and authentication in IIS are you using windows authenticaton
0
 

Author Comment

by:lapucca
ID: 40511377
I will set it up in IIS to use Windows authentication.  However, I'm still developing the program and right now it's just running on my local PC from VS2012.  But still, shouldn't it display the name?
0
 
LVL 12

Accepted Solution

by:
Ammar Gaffar earned 300 total points
ID: 40511404
How you are expecting to have user identity information without authentication?

Unless you setup your IIS to use Windows Authentication and configure your asp.net application to use Windows Authentication mode and login using your windows credentials you will not be able to read user identity information.
0
 

Author Closing Comment

by:lapucca
ID: 40511861
Okay, that makes sense.  I'll see if that works when I set it up in our IIS server.    Thank you.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now