Solved

How to get current user's name?

Posted on 2014-12-20
7
286 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 79

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

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.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
In SQL Server 2016, can we configure MASKing rules that applies for application level users ? 12 58
InputLanguage 1 27
Problem!!! 8 33
Powershell File Sort 8 31
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

832 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