I am trying to read and write from drive C: in my program but every time I select the drive it throws the FileIOPermission exception.Please tell me how to make application to access the protected path without exception.Also the solution works fine when debug in Visual Studio. Here is exception preview.
Preview
Code`
public void Start()
{
try
{
if ( !Directory.EnumerateFileSystemEntries(Path.Text).Any()==true)
{
MessageBox.Show("Directory is Empty");
}
}
catch (Exception ex)
{
MessageBox.Show($"Sorry cannot read directory because {ex.ToString()}");
Startthread.Abort();
}
}