Hi all,
I have changed my question completly so created a new question.
I have written a code where it's reading the drives in MY COMPUTER but when i conncet my mobile to my laptop with data cable and refresh the page, it's displaying only my mobile's drive. Actually it should show both my drives and mobile drive but it's showin only 1.
And how to reteive the NETWORK LOCATION (mapped drives) disk size?
Below is my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Data.Common;
using System.Data;
public partial class DriveThreshold : System.Web.UI.Page
{
class Report
{
public static void Main()
{
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void DriveInfo_Click(object sender, EventArgs e)
{
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}", d.Name);
Console.WriteLine("Drive type: {0}", d.DriveType);
if (d.IsReady == true)
{
Console.WriteLine("Volume label: {0}", d.VolumeLabel);
Console.WriteLine("File system: {0}", d.DriveFormat);
Console.WriteLine("Available space to current user:{0, 15} bytes", d.AvailableFreeSpace);
Console.WriteLine("Total available space: {0, 15} bytes", d.TotalFreeSpace);
Console.WriteLine("Total size of drive: {0, 15} bytes ", d.TotalSize);
DataTable dt = new DataTable();
dt.Columns.Add("Drive");
dt.Columns.Add("Drive type");
dt.Columns.Add("Volume label");
dt.Columns.Add("Available space to current user");
dt.Columns.Add("Total available space");
dt.Columns.Add("Total size of drive");
DataRow dr = dt.NewRow();
dr[0] = d.Name;
dr[1] = d.DriveType;
dr[2] = d.VolumeLabel;
dr[3] = d.AvailableFreeSpace;
dr[4] = d.TotalFreeSpace;
dr[5] = d.TotalSize;
dt.Rows.Add(dr);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
}
}
Please help me with this.
What I have tried:
I'm unaware of this how to handle in asp.net.