C# .NET - how to check read write permission of shared folder on network pc for user

Asked By vivek P on 02-Feb-09 01:31 AM
i want to write on file on network shared folder. but my application throws exception if that folder doesn't have write permission so i want to check permission for particular user.

re - Web Star replied to vivek P on 02-Feb-09 01:41 AM

u can get every thing using FileIOPermission

The following examples illustrate code that uses FileIOPermission. After the following two lines of code, the object f represents permission to read all files on the client computer's local disks. The code example then demands the permission to determine whether the application has permission to read the files.

FileIOPermission f = new FileIOPermission(PermissionState.None);
f.AllLocalFiles = FileIOPermissionAccess.Read;
catch (SecurityException s)

check this - Santhosh N replied to vivek P on 02-Feb-09 01:50 AM

check this which is speaking about checking folder permissions..


but - vivek P replied to Web Star on 02-Feb-09 02:01 AM

Thanks for reply.. fp.Demand() will throw will throw the exception if user don't have write permission. but can't i check permission without any exception throwing?