i have active directory configured and i have added two user x and y and my domain is DOMAIN. And i have created an application where i these two can login with their username DOMAIN/X and DOMAIN/Y. But Here's the scenario i will add the intended user details into the database like their username and password and I want to show a login button without username and password fields who were within my LAN and i should be able to get the PC name and then i will verify it across username which i have saved in Db and get the username and password to validate him. So basically is there any way to get the Computer name from where the user tried to access the application within my LAN
Asked
Active
Viewed 396 times
1 Answers
0
you can use this piece of code to get the pc name
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
but if you will be saving the name of the pc as just the name it might end up having more then one name of the same.
if its just for each computer you want to register I would suggest going for MAC address
not sure exactly how its done but maybe this link will help you

Community
- 1
- 1

BlackStarHH
- 75
- 2
- 11
-
Thanks for reply.I have one thing in my mind if i use this will i be able to get the name of the PC of the actual user who is accessing the Application or the PC-name where i hosted the App. Because i have used Environment.UserName but its giving me the pcname where the app is hosted that's our server PC – Vivekh Sep 30 '14 at 09:54