Reputation: 21
i am using windows 8 and its on the domain. using machine logged-in credential information i have to pass info which accessing the website in the same domain. (info like username of the client logged in machine.)
I tried with the code below:
string dsfsdf = Page.User.Identity.Name;
unable to get the requestor info.
Upvotes: 2
Views: 1411
Reputation: 783
You can get the user information from the WindowsIdentity object by doing the following
WindowsIdentity identity = HttpContext.Current.Request.LogonUserIdentity;
You can find information on the object here
There is a property called Name that will give you the authenticated user name.
To get the clients machine name, you could use this:
string clientMachineName = Dns.GetHostEntry(Request.ServerVariables["remote_addr"]).HostName);
Hope that helps.
Upvotes: 2