473,320 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

File System Security

Hi,

Does anyone know how to change access rights in C#. I want to create a
program that changes adds trustees to certain files as they arrive on my
server.
I have tried searching MSDN, but that did'nt help...

Thanks,
Philip
Nov 15 '05 #1
3 2045
System.Management provides classes to use WMI. Using WMI you should be able
to change access restrictions for files, folders, or whatever else you might
want to change access restrictions for.

http://msdn.microsoft.com/library/de..._directory.asp

Above is a sample link to get you started. I'm afraid WMI is a fairly
complex beast, so you'll have to do some research to get the rest of your
answer.

--
Justin Rogers
DigiTec Web Consultants, LLC.

"Philip Carnstam" <ph*************@carnstam.net> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hi,

Does anyone know how to change access rights in C#. I want to create a
program that changes adds trustees to certain files as they arrive on my
server.
I have tried searching MSDN, but that did'nt help...

Thanks,
Philip

Nov 15 '05 #2
Philip Carnstam wrote:
|| Hi,
||
|| Does anyone know how to change access rights in C#. I want to create
|| a program that changes adds trustees to certain files as they arrive
|| on my server.
|| I have tried searching MSDN, but that did'nt help...
||
|| Thanks,
|| Philip

Your best option is to use Process.Start to run CACLS.EXE, all other options (WMI, DirectoryServices, Win32 API .... ) are complex.

Willy.
Nov 15 '05 #3
Thanks, that was just the solution I was seeking!

"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:ez**************@TK2MSFTNGP10.phx.gbl...
Philip Carnstam wrote:
|| Hi,
||
|| Does anyone know how to change access rights in C#. I want to create
|| a program that changes adds trustees to certain files as they arrive
|| on my server.
|| I have tried searching MSDN, but that did'nt help...
||
|| Thanks,
|| Philip

Your best option is to use Process.Start to run CACLS.EXE, all other options (WMI, DirectoryServices, Win32 API .... ) are complex.
Willy.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul | last post by:
Dear All, I want to use web form to upload my file and copy the file to another machine. I can upload the file, but when I copy the file(file.CopyTo(".....", true)) to another machine(map...
9
by: John | last post by:
Tried this on microsoft.public.access.gettingstarted - no response - perhaps more appropriate here. I'm not a database user, simply helping someone get started with a new computer. The old...
10
by: JJ | last post by:
How can I get a SiteMapNodeCollection to output as an XML file?
1
by: Ryan | last post by:
I am trying to log events to SQL Server instead of the computers event log, but, although I get no errors, I have no luck. The webevents_events table is empty. I have a custom event that I am...
2
by: levimc | last post by:
I know that that topic may be old to you but I looked at other more- than-two-year-old topics related to mine. However, I didn't find them working for my project at all because its errors return...
3
by: JDeats | last post by:
I have some .NET 1.1 code that utilizes this technique for encrypting and decrypting a file. http://support.microsoft.com/kb/307010 In .NET 2.0 this approach is not fully supported (a .NET 2.0...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
0
by: zechdc | last post by:
I have been at this for two weeks now. I am trying to send two variables from a flash file located on newgrounds.com, kongregate.com, armorgames.com or any other site like that to a php file on my...
2
ssnaik84
by: ssnaik84 | last post by:
Hello, I have hosted a website on GoDaddy.com. It's a share hosting. I am using XML file as a database. That means, I am reading and writing data into XML file instead of regular RDBMS (MySQL, MS...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.