473,387 Members | 1,705 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.

Does FileStream.GetAccessControl exist?

According to the help, under .NET2.0 the FileStream class has public members
GetAccessControl and SetAccessControl, but when I try to call these on an
instantiation of FileStream I get a compiler error. Oddly, the error says
"System.IO.Stream does not contain a definition for GetAccessControl".
Am I missing something??
--
Dave
Jul 6 '06 #1
2 3094
Hi Dave

You are not intantiating a FileSteam, but something that returns a Stream, or you are casting the object to Stream, hence the error message. The code below will work.

using System.IO;

using (FileStream fs = new FileStream(@"c:\my.file", FileMode.Open))
{
System.Security.AccessControl.FileSecurity fc = fs.GetAccessControl();
}

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 6 '06 #2
Aaaarrrrgh. You're absolutely right. I'm so sorry
--
Dave
"Morten Wennevik" wrote:
Hi Dave

You are not intantiating a FileSteam, but something that returns a Stream, or you are casting the object to Stream, hence the error message. The code below will work.

using System.IO;

using (FileStream fs = new FileStream(@"c:\my.file", FileMode.Open))
{
System.Security.AccessControl.FileSecurity fc = fs.GetAccessControl();
}

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 6 '06 #3

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

Similar topics

0
by: Bohus | last post by:
I want that my thread sleeps until file is unlocked, but if I wait for signaled state of FileStream handle, it does not work and ARE.WaitOne() function returns immediately, even if file is locked...
3
by: John Tyce | last post by:
My stream writer is creating the file, but writes no text in it. if(MyDataSet.Tables != null) { MyDataSet.WriteXml(@"C:\DISWin\Report\userdata.xml");
28
by: Peter Olcott | last post by:
I want to double check my understanding about how the .NET framework works. From what I understand every call to the .NET framework is ultimately translated into one of more API calls, is this...
1
by: pgmfan | last post by:
What is the difference among filestream, memoryStream and byte stream, how do i use each properly. i confused by them appreciate for any advice ,please help
0
by: Dean Hinson | last post by:
troHello, I write alot of VB Scripts to review AD information. I decided to use VB ..net and incorporate the functions of my various scripts into one program. However, using .net 2.0 framework...
51
by: Tony Sinclair | last post by:
I'm just learning C#. I'm writing a program (using Visual C# 2005 on WinXP) to combine several files into one (HKSplit is a popular freeware program that does this, but it requires all input and...
10
by: KarlM | last post by:
Hallo! System.Security.AccessControl.FileSecurity (GetAccessControl) works fine. Now I would like to use GetAccessControl for Active Directory Objects like computers. I've searched a lot but...
0
by: =?Utf-8?B?cm95?= | last post by:
Hi, We've recently upgraded our ASP.Net 1.1 web application to ASP.Net 2.0 (Web Application Project Model). One one of our staging web servers (W2K), we've started receiving the above error...
4
by: Andrus | last post by:
To reporoduce, run the code. Observed: Form is shown Expected: message box should displayed. How to fix ? Andrus.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...

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.