Getting share & file permissions

D

David Thielen

Hi;

Ok, I've almost got my system to handle opening files using any uname/pw
setup. One item remains.

If a share and file is set to allow "Everyone" then I want to allow any user
to open it. This requires either:
1) Is there a way to get the access rights for a share and for a file in the
share? In this case I can test for "Everyone" and have my ASP.NET user open
it.
2) Is there a way to impersonate an anonymous user and open it? This would
then fail if access was not set to Everyone.
3) Is there another way to do this?

BTW - once I get this part solved, I will put the full code in my blog and
post a link from here. This will give file access a system similiar to
XmlUrlResolver for http/ftp.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
J

Joe Kaplan

David, it is almost never a good idea to try to interpret the security
descriptor yourself. It is very easy to get the logic wrong.

Instead, the better thing to do is to call the Win32 AccessCheck API. Once
again, there is no good .NET equivalent, but I bet there is a wrapper
available at www.pinvoke.net or something.

Best of luck,

Joe K.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,989
Messages
2,570,207
Members
46,782
Latest member
ThomasGex

Latest Threads

Top