Solved

How to get current user's name?

Posted on 2014-12-20
7
276 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 82

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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

15 Experts available now in Live!

Get 1:1 Help Now