Thursday, September 4, 2008

Client Local Machine name

If you need the client local machine name, then here is the code:

The below code gets the machine name and stores it in a session variable.
Session["MachineName"] = Environment.MachineName; //gets client machine name

You can use Session["MachineName"] simply in the files to refer to session variable which is of type Object. But in case, you need to refer the session variable in the dll classes, then you would need to refer it as:
System.Web.HttpContext.Current.Session["MachineName"]

No comments:

About Us