Here is how you can do using C#,
Response.Write("machinename " +System.Environment.MachineName +"<BR>" )
This gives you name computer where your webserver is located.
If you need with the domain name here is how you can achieve using the following code snippet:
You need to import following namespace to use this,
using System.Net;
public static string GetServerMachineName()
{
string domainName = System.Net.NetworkInformation.IPGlobalProperties.GetIPGlobalProperties().DomainName;
string hostName = Dns.GetHostName();
string sysdn = "";
if (!hostName.Contains(domainName))
sysdn = hostName + "." + domainName;
else
sysdn = hostName;
return sysdn;
}