4
Answers

Current user email ID in ASP.Net

Maroof Raini

Maroof Raini

11y
2.9k
1
Hi, I have created a one page application where I need to display user's email in a text box. Here user email refers to the outlook email ID of the user who is logged in into the machine. I am trying the below code 

txtEmail.Text = System.DirectoryServices.AccountManagement.UserPrincipal.Current.EmailAddress;

The code returns correct email ID while running directly (Press F5) as [email protected]. Then I deploy my application in IIS but now on browsing the url it gives some other ID as websol@...... Can someone help me please ? I have already Checked "Basic Authentication" and "Integrated Windows Security" and unchecked "Anonymous Access" in IIS Directory Security.
Answers (4)