Re: Ridicilous!
From: gary hitch (gary.hitch.dmr_at_drdc-rddc.gc.ca)
Date: 04/08/04
- Next message: Tom: "Convert filename to UNC"
- Previous message: Brent: "Re: Error Message - Access Denied to Assembly"
- In reply to: Ayende Rahien: "Ridicilous!"
- Next in thread: Evan Freeman[C++ Samuri]: "Re: Ridicilous!"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Apr 2004 15:29:40 -0400
Ok, I think I misunderstood your purpose.
Did you check - FileIOPermission.GetPathList Method and the param
FileIOPermissionAccess Enumeration ?
BTW, the exception catch thing seems to me to be the easiest way to go with
your requirements
8-)
"Ayende Rahien" <Ayende@no.spam> wrote in message
news:O3#3iEXHEHA.3968@TK2MSFTNGP12.phx.gbl...
> <rant warning="I'm pissed off and have to vent" request="need help>
> For the last couple of hours I'm struggling with a very *annoying*
problem.
> How to check if a user has a write access to a file?
> Considerring that .Net is supposed to be a system for writing applications
> for servers & clients, which in both cases has may have multi-users, I'm
> amazed that this is not possible in the framework.
> Initially I looked for something like:
>
> System.IO.File.Access(string Filename, PermissionAccess);
>
> Nothing!
>
> Then I thought about System.Security.Permissions, and there is was, clear
as
> day FileIOPermission a class which "Controls the ability to access files
> and folders."
> But no! FileIOPermission works for .Net permissions, it doesn't do Win32
> permissions!
>
> Considerring that the framework is supposed to run on server class
> platforms, why the omission?
>
> In C & C++ I can do _access() and get the info I want, in .Net? I get to
> delve into:
>
> A> Interop code.
> B> Win32 Security.
>
> I can handle Interop if I absolutely have to, but even on a good day,
using
> C++ I don't like Win32 Security, and all the tricks that are used there.
> I checked ACLs in .Net
>
http://www.gotdotnet.com/community/usersamples/details.aspx?sampleguid=e6098
575-dda0-48b8-9abf-e0705af065d9
> No go, it requires me to add a component that is bigger then my code just
to
> do so, and add several level of complexities to my life.
> Not to mention, again, having to deal with all the minor details of Win32
> security.
>
> To remind you, I'm trying to find out if my code has write access to a
file,
> on a framework that support multiply users, networks and such, this should
> be a snap.
> Instead...
>
> Opening a file and catching the exception is the only easy way that I've,
> and that is *not acceptable*.
> </rant>
>
> Seriously now, I really need a way to solve this problem, preferably with
> something like:
> FileAccess.Verify(filename,WriteAccess);
>
> Thanks in advance,
> Ayende Rahien
>
>
- Next message: Tom: "Convert filename to UNC"
- Previous message: Brent: "Re: Error Message - Access Denied to Assembly"
- In reply to: Ayende Rahien: "Ridicilous!"
- Next in thread: Evan Freeman[C++ Samuri]: "Re: Ridicilous!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|