View Disk info on your web page

This is a very simple C# code snippet which allows you to display the Hard Disk info such as Total disk storage and Free Disk space on your machine. I found this intersting since it reveals a bit of local machine’s info through a browser.

Here goes the code.

using System.Management;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ManagementObject disk = new ManagementObject(“win32_logicaldisk.deviceid=\”c:\””);
disk.Get();
Response.Write(“Logical Disk Space = ” + disk[“Size”] + “bytes. “);
Response.Write(“Free space on C:\\ is ” + disk[“FreeSpace”] + ” bytes. “);
}
}

As you can see a Management object is created specifying the System Drive. You can access to its properties by the index of the Management Object. ex:- disk[“Size”] will give you the Total size of the drive.

Enjoy!!!

View the IP network path on a map

This is about a program which displays the path of a network packet in a map when u ‘traceroute’ to a server. As U know, when u traceroute to a particular server, the resulting IP addresses are the routers that the packets passed through on their way to the destination.

So in this program, the Geo-location of the ip address is obtained by a web service provided freely by the HostIP. And once you obtained the location in terms of lattitude and longitudes, then you can mark that location in a Virtual Earth API provided by Microsoft Mappoint services.  And finally the network path is drawn in the map.

 tracertmap1.jpg

You can also find a tool similar to this in Google Gadgets. U can add one of those gadgets when u customize your Google Personalized Home page.

For more info about this Trace Route Map tool, visit here.