Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET Function to Check user has read access to a file

Reply
Thread Tools

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

 
 
Girish bharadwaj
Guest
Posts: n/a
 
      09-23-2004
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
"Raed Sawalha" <> wrote in message
news:...
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!


 
Reply With Quote
 
 
 
 
Raed Sawalha
Guest
Posts: n/a
 
      09-23-2004
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!
 
Reply With Quote
 
 
 
 
Raed Sawalha
Guest
Posts: n/a
 
      09-23-2004
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
"Girish bharadwaj" <> wrote in message
news:...
> 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
> "Raed Sawalha" <> wrote in message
> news:...
> 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!
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File.read(fname) vs. File.read(fname,File.size(fname)) Alex Dowad Ruby 4 05-01-2010 08:20 AM
How to check whether user put a check in a toolbox CheckBox contro JB ASP .Net 1 08-26-2009 11:18 PM
This function has an onClick event that calls a function that calls This function Bob Javascript 5 10-24-2006 04:11 PM
Read all of this to understand how it works. then check around on otherRead all of this to understand how it works. then check around on other thelisa martin Computer Support 2 08-18-2005 06:40 AM
Need function to test if EFFECTIVE UID has read-access to a file. Markus Kemp Python 8 11-18-2004 08:48 PM



Advertisments