I have found following, but I am not sure all Windows OS(XP/2000/NT/98..) will have the "COMPUTERNAME" environment variable.
System.Environment.GetEnvironmentVariable("COMPUTERNAME");
Is there any better & more reliable way to get hostname/computer name of local machine, where my application are going to run?
Thanks,
Avin Patel
System.Windows.Forms.SystemInformation.ComputerName
Lajos Malozsák
"Avin Patel" <Avin...@discussions.microsoft.com> wrote in message
news:4B978C82-FF24-4F72...@microsoft.com...
string myHostName = System.Net.Dns.GetHostName();
or
string myHostName = Environment.MachineName;
Shak.
"Avin Patel" <Avin...@discussions.microsoft.com> wrote in message
news:4B978C82-FF24-4F72...@microsoft.com...
> string myHostName = System.Net.Dns.GetHostName();
>
Documentation says: It would return DNS host name, NOT machine name / computer name / host name.
> or
>
> string myHostName = Environment.MachineName;
>
"Environment.MachineName" not found in documentation. But I tried & it works.
Is this a magic?? How can be it guranted to work in user application??
Thanks,
Avin Patel
Thanks,
Avin Patel
Thanks,
Avin Patel
Thanks,
Avin Patel