ASP.NET Function to Check user has read access to a file

  • Thread starter Thread starter Girish bharadwaj
  • Start date Start date
G

Girish bharadwaj

I would think FileIOPermission might help you. See help for that class and
related Security demands and asserts to see if they help you out.

--
Girish Bharadwaj
http://msmvps.com/gbvb
Hi all,

I need a function which will return read access for the current user as true
or false when a file path is passed to it (either local or UNC share).

My web-config file is using windows authentication and impersonate = true.
The idea is to check that the user has access to each file before displaying
it in a list.

Thanks for any help!
 
Hi all,

I need a function which will return read access for the current user as true or false when a file path is passed to it (either local or UNC share).

My web-config file is using windows authentication and impersonate = true. The idea is to check that the user has access to each file before displaying it in a list.

Thanks for any help!
 
ya that worked fine i did like this and worked perfectly

FileIOPermission f = new
FileIOPermission(FileIOPermissionAccess.AllAccess,MyFile);


try

{

f.Demand();

return true;



}

catch

{

Exception ex = new Exception();

string s = ex.Message ;

return false

}

Thanks
 
Back
Top