473,387 Members | 1,766 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,387 software developers and data experts.

changin the rights on a file or a directory

Hi all,

I'm trying to set rights on a file or a directory with a C# program. I have
tried with WMI, Win32 classes, etc, but I didn't manage to do it. Could
anyone help me? Does anyone have a website, a free sourcecode, a sample, or
anything that could help me changing access rights on a file ?

Thanks,

Florent
Nov 15 '05 #1
2 1404
Look at the class System.IO.File, it has two methods:

GetAttribute
SetAttribute

"Florent" <jo****@hotmail.com> schrieb im Newsbeitrag
news:Oj****************@TK2MSFTNGP11.phx.gbl...
Hi all,

I'm trying to set rights on a file or a directory with a C# program. I have tried with WMI, Win32 classes, etc, but I didn't manage to do it. Could
anyone help me? Does anyone have a website, a free sourcecode, a sample, or anything that could help me changing access rights on a file ?

Thanks,

Florent

Nov 15 '05 #2
Hi,
I've already tried this, it only allows you to change the "write only" or
"hidden" attributes, you cant change the NTSecurityPermissions with this.

Thanks

"Zürcher See" <aq****@cannabismail.com> a écrit dans le message de
news:%2****************@TK2MSFTNGP12.phx.gbl...
Look at the class System.IO.File, it has two methods:

GetAttribute
SetAttribute

"Florent" <jo****@hotmail.com> schrieb im Newsbeitrag
news:Oj****************@TK2MSFTNGP11.phx.gbl...
Hi all,

I'm trying to set rights on a file or a directory with a C# program. I

have
tried with WMI, Win32 classes, etc, but I didn't manage to do it. Could
anyone help me? Does anyone have a website, a free sourcecode, a sample,

or
anything that could help me changing access rights on a file ?

Thanks,

Florent


Nov 15 '05 #3

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

Similar topics

5
by: Paul | last post by:
Hi all, On my local pc I have built a webpage which reads data from a ms-access file. No problem at all. When I place the files on our intranet-server I receive an error: ...
12
by: Quentin Huo | last post by:
Hi: I am working in win 2003 and ASP.NET. I tried to modify the user rights from an ASPX (writen in C#) page through running xcacls. But failed. What I did is: Process myProcess = new...
0
by: cbanks | last post by:
I have written a Web Application in VB.Net 2003 that I need to perform a mail merge on. I have been able to sucessfully collect the data and write it to a file on my website using XSLTransform. I...
1
by: Aftab Alam | last post by:
Hello All I want to change the keyboard layout dynaically, ie if a use focuses on my application the keyboard layout gets set to Arabic and if on any other application it should be english ?? How...
0
by: Torsten Valentin | last post by:
Hi! I have to write a program that should create a new directory ("c:\test") and share that directory with read-access for everyone and read-write-access for administrators. How do I do that in...
3
by: Dirk Deimeke | last post by:
Hi, one Windows administrator changed the servername (hostname) of one of our database servers. What changes do I have to to to get my databases connected? The catalog statements have to be...
5
by: jannordgreen | last post by:
I use windows 2000 and Visual Studio 2003. I have a vbnet web application on our intranet that needs to read a text file that sits on a different server. The general user does not have access to...
3
by: jehugaleahsa | last post by:
Hello: I have been looking online trying to find a simple way to find file/ directory rights in C#. I have been seeing a lot of options, none of which are obvious. I am looking for something...
3
by: Koliber (js) | last post by:
sorry for my bad english when I fire up (from my c# code) a standard "file - save as " dialog, and when chosen location is a shered local network directory, where I do have rights to create...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.