CDROM path

G

Guest

I am calling an ASP .NET page through the Web, save it locally and then burn it on a CD. How can I determine the path of the CDROM in which the page resides since each user may have a different drive letter?

Thanks
 
A

avnrao

include System.Management;

use this code

ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From
Win32_LogicalDisk");
ManagementObjectCollection col = query.Get();
foreach(ManagementObject mo in col)
{
if(int.Parse(mo["DriveType"].ToString()) == 5) // 5 is for CD Rom.
Console.WriteLine("CD Drive " + mo["Name"].ToString());
}

Av.
 
H

Hugo Wetterberg

The easiest way is to do a MapPath(Request.ApplicationPath) and then
extract the drive letter/path from the resulting physical path. The
Management method gives you the CD-ROM(s), but doesn't tell you which
one your application is in.
/Hugo
include System.Management;

use this code

ManagementObjectSearcher query = new ManagementObjectSearcher("SELECT * From
Win32_LogicalDisk");
ManagementObjectCollection col = query.Get();
foreach(ManagementObject mo in col)
{
if(int.Parse(mo["DriveType"].ToString()) == 5) // 5 is for CD Rom.
Console.WriteLine("CD Drive " + mo["Name"].ToString());
}

Av.
I am calling an ASP .NET page through the Web, save it locally and then
burn it on a CD. How can I determine the path of the CDROM in which the
page resides since each user may have a different drive letter?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top