Is there any way to find newly added device like usb, mouse, cd-rom etc? using asp.net with c#
when we use this method it gives information about all devices
DriveInfo[] allDrives = DriveInfo.GetDrives();
foreach (DriveInfo d in allDrives)
{
Console.WriteLine("Drive {0}, Type {1}", d.Name, d.DriveType);
}
We can also find the removable device like usb using DriveType method but when attach external cd-rom with my system it shows same as other CD-rom which is already attach with my system.
I am using system.Io library.
Is there any way to differentiate previous and newly added cd-Rom. one thing more we don’t have any idea how much new devices user can attach to the system, i mean to say he/she can attach as many devices as they want. we can’t restrict them.
Thanks
I don’t know if you can get the newly added devices without build your own watcher:
ex: http://www.codeproject.com/KB/system/DriveDetector.aspx
A simpler solution, you can save the previously readed devices on a list/DB and compare the new getted list with the saved.
BTW: In this way you will the get the attached drives on server, is it right? If you wanna get the client devices list you have to change the approach at all.