Click here to Skip to main content
15,914,225 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
block usb in asp.net c# code or we can assign permission of read write for particular usb
Posted

Hi,

I think you cannot block USB of client machine using ASP.NET application. but you can take a chance of doing using ActiveX, but still am not sure that you will find an option.
 
Share this answer
 
v3
Hi Bhargavpp,

You can do this by modifying the registry via C# code.

C#
using Microsoft.Win32;
RegistryKey key;
key = Registry.LocalMachine.OpenSubKey
         ("SYSTEM\\CurrentControlSet\\Services\\UsbStor");
key.SetValue("Start", 4, RegistryValueKind.DWord);  //disables usb drives
key.SetValue("Start", 3, RegistryValueKind.DWord);  //enables usb again



Any devices already connected will remain there, but no new usb drives plugged in will be automatically mounted.


Happy Coding..!

Thank you,
Vamsi
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900