Click here to Skip to main content
15,885,101 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i would like to get the computer name when my site is hosted on iis server.

i will get the username when i running my site from local. here is my code.

PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
UserPrincipal userp = UserPrincipal.Current;

but when i publish my site on iis server i m not getting the system name
Posted

1 solution

Try any one from below
C#
System.Environment.MachineName
or 
SystemInformation.ComputerName
or 
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
or 
String hostName = Dns.GetHostName();


link may help Get Client computer name
 
Share this answer
 
v2
Comments
Member 10919160 1-Sep-14 9:06am    
i have tried all this it is not working
Ranjeet Patel 1-Sep-14 9:10am    
Did you get any error?
Member 10919160 1-Sep-14 9:19am    
noplease see this link:
http://mobileapi.jobseeders.com/index.aspx
Click on comp button
Ranjeet Patel 1-Sep-14 9:29am    
finally I googled and find out this link see if it helps

http://stackoverflow.com/questions/1444592/determine-clients-computer-name

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900