Last post Mar 01, 2017 12:42 AM by mgataric
Feb 27, 2017 05:23 AM|mgataric|LINK
Hi. What is the best way to get AD account (domain name and user name) of the user who is currently logged on the machine? I’m using ASP.net and C#. Thanks in advance.
Feb 27, 2017 07:40 AM|ignatandrei|LINK
Activate Windows Authentication and disable anonymous in IIS
Feb 27, 2017 11:12 PM|mgataric|LINK
Thanks Andrei. I forgot to say that this is in fact "intranet" application and I'm using web forms authentication.
Feb 28, 2017 06:21 AM|Jean Sun|LINK
You can use the following code to get the current logged in user name.
var name = System.Web.HttpContext.Current.User.Identity.Name;
Feb 28, 2017 12:26 PM|ignatandrei|LINK
I forgot to say that this is in fact "intranet" application and I'm using web forms authentication.
I do not understand why it uses web forms authentication instead of AD authentication.
Does the user enters HIS windows credentials on the web forms ?
Mar 01, 2017 12:42 AM|mgataric|LINK
Thank you Jean and Andrei. I'll try Jean's suggestion. The reason for "web forms" authentication is that not all users in the domain are permitted access to the site. I inherited this web site and I'm beginner in the field. Do you have a better way to authenticate
users, Andrei? This works, but if there is a better way, I might use it. Once again: I want only certain users in the domain to have access to the site. Right now there is a password presented to the user at the moment when she/he wants to access it.
Thanks again Andrei.