Finding Client Machine name, User name or Domain name in asp.net
Posted by Sujit Kumar on August 14, 2008
Find Client Machine Name, User Name or Domain Name in Asp.net using Java Script
function GetClientInfo()
{
var net = new ActiveXObject(“wscript.network”);
document.write(“Computer Name : “+net.ComputerName +”‘\n User Name : “+net.UserName+”\n Domain Name : ” +net.UserDomain);
}
Josh said
When i use this I get a script error that the object could not be created. Any advice?
Sujit Kumar said
It is working fine with asp.net and html both , you have to allow activex control on your web browser.
ex:
function GetClientInfo()
{
var net = new ActiveXObject(“wscript.network”);
alert(“Computer Name : “+net.ComputerName +”\n User Name : “+net.UserName+”\n Domain Name :”
+net.UserDomain);
}
sekhar said
function GetClientInfo() for getting clients machine domain name ,username,.. it is not working
Sujit Kumar said
could you please give me the error details so I can solve the issues. I have implented in asp.net 2.0 with IE-7 and it is working fine.
code is below;
Untitled Page
function create()
{
var net = new ActiveXObject(“wscript.network”);
//alert(net.UserDomain+’: ‘+net.ComputerName);
document.write(“Computer Name : “+net.ComputerName +”‘\n User Name : “+net.UserName+”\n Domain Name : ” +net.UserDomain);
}