Granting file delete permission to another user

T

Tim Werth

I have a Windows Service that is running as an administrator account. Some
of it methods create files for a COM+ client to digest and puts them in
C:\Documents and Settings\All Users\Application Data\... The file is
created with a StreamWriter.

When the COM+ client (running as a non-admin user) is finished with the
file, it tries to clean it up but gets a Permission denied error.

How can the service programmatically grant delete privileges so the
non-admin user (COM+ clients) can delete the file?

Thanks,
Tim
 
V

Victor Urnyshev [MSFT]

Tim,

I think you have to use Win32 API to do this. Please take a look at the
method SetFileSecurity in Win32 API.
In general files are not a very reliable way of passing data between
components. Do you have an option to exclude files from the components
communication?

--
Victor Urnyshev [MSFT]
This post is "AS IS" with no warranties, and confers no rights.
--------------------
|Reply-To: "Tim Werth" <[email protected]>
|From: "Tim Werth" <[email protected]>
|Subject: Granting file delete permission to another user
|Date: Wed, 14 Jul 2004 17:34:39 -0500
|Lines: 15
|X-Priority: 3
|X-MSMail-Priority: Normal
|X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
|X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
|Message-ID: <[email protected]>
|Newsgroups: microsoft.public.dotnet.general
|NNTP-Posting-Host: ckpnt02.intergraph.com 63.75.137.129
|Path:
cpmsftngxa06.phx.gbl!cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP11.phx.gbl
|Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:139577
|X-Tomcat-NG: microsoft.public.dotnet.general
|
|I have a Windows Service that is running as an administrator account. Some
|of it methods create files for a COM+ client to digest and puts them in
|C:\Documents and Settings\All Users\Application Data\... The file is
|created with a StreamWriter.
|
|When the COM+ client (running as a non-admin user) is finished with the
|file, it tries to clean it up but gets a Permission denied error.
|
|How can the service programmatically grant delete privileges so the
|non-admin user (COM+ clients) can delete the file?
|
|Thanks,
|Tim
|
|
|
 
P

Punjab Peety

Tim said:
I have a Windows Service that is running as an administrator account.
Some of it methods create files for a COM+ client to digest and puts them
in
C:\Documents and Settings\All Users\Application Data\... The file is
created with a StreamWriter.

When the COM+ client (running as a non-admin user) is finished with the
file, it tries to clean it up but gets a Permission denied error.

How can the service programmatically grant delete privileges so the
non-admin user (COM+ clients) can delete the file?

Thanks,
Tim

Did you check security settings in the assembly cache ?
 
T

Tim Werth

Victor,

Thanks for the suggestion. I ended up solving it by calling
AddAccessAllowedAceEx. I found this solution in a post by Willy Denoyette
(Subj: Re: dotNEt File Permissions LONG).

But to answer you question, no, unfortunately at this point I don't have
another option for the component's communication than using files.

Tim
 

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

Top