You can use System.Environment like this:
private string SystemInformation()
{
StringBuilder StringBuilder1 = new StringBuilder(string.Empty);
try
{
StringBuilder1.AppendFormat("Operation System: {0}<br />", Environment.OSVersion);
if (Environment.Is64BitOperatingSystem)
StringBuilder1.AppendFormat("64 Bit Operating System<br />");
else
StringBuilder1.AppendFormat("32 Bit Operating System<br />");
StringBuilder1.AppendFormat("SystemDirectory: {0}<br />", Environment.SystemDirectory);
StringBuilder1.AppendFormat("ProcessorCount: {0}<br />", Environment.ProcessorCount);
StringBuilder1.AppendFormat("UserDomainName: {0}<br />", Environment.UserDomainName);
StringBuilder1.AppendFormat("UserName: {0}<br />", Environment.UserName);
StringBuilder1.AppendFormat("LogicalDrives:<br />");
foreach (System.IO.DriveInfo DriveInfo1 in System.IO.DriveInfo.GetDrives())
{
try
{
StringBuilder1.AppendFormat("Drive: {0}<br />VolumeLabel: {1}<br />DriveType: {2}<br />DriveFormat: {3}<br />TotalSize: {4}<br />AvailableFreeSpace: {5}<br />",
DriveInfo1.Name, DriveInfo1.VolumeLabel, DriveInfo1.DriveType, DriveInfo1.DriveFormat, DriveInfo1.TotalSize, DriveInfo1.AvailableFreeSpace);
}
catch
{
}
}
StringBuilder1.AppendFormat("SystemPageSize: {0}<br />", Environment.SystemPageSize);
StringBuilder1.AppendFormat("Version: {0}", Environment.Version);
}
catch
{
}
return StringBuilder1.ToString();
}
The most commonly used method to do this is to use java script, for example you can use this code to find out resolution of his/her computer:
<script type="text/javascript">
document.write(screen.width);
document.write('*');
document.write(screen.height);
</script>
You can use JavaScript to collect some valuable information such as user’s IP or location of user etc. Just search Google and you will find plenty of this useful Java Scripts. You can also use other .NET classes to do this, for example for finding IP of client you can use:
Request.UserHostAddress
or
Request.ServerVariables["REMOTE_ADDR"].ToString()
or to show URL of the client's previous request that linked to your webpage you can use
Request.UrlReferrer
.