473,403 Members | 2,071 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,403 software developers and data experts.

Current Context File Access Type in .NET 2

How can I implement a function to show what kind file security access the
current context has on a file, for example:-
public enum AccessType
FullControl
Modify
Read
Write
end enum

private function GetAccess(pathStr as string) as AccessType
...
end function

Hope this explains.

I know I could wrap code inside a try catch block, but this seems a little
expensive. Hopefully there is something in the new FileSecurity features in
..NET that does this a little smarter.

Any help would be greatly appreciated.
May 27 '06 #1
1 1010
Take a look at System.Security.AccessControl
http://msdn2.microsoft.com/en-US/lib...sscontrol.aspx

File.GetAccessControl http://msdn2.microsoft.com/en-US/library/8e1fc3b8.aspx
is probably the specific method you are looking for (and includes an
example of adding/removing).

Cheers,

Greg Young
MVP - C#
"Davie" <dx*@mms.co.uk> wrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
How can I implement a function to show what kind file security access the
current context has on a file, for example:-
public enum AccessType
FullControl
Modify
Read
Write
end enum

private function GetAccess(pathStr as string) as AccessType
...
end function

Hope this explains.

I know I could wrap code inside a try catch block, but this seems a little
expensive. Hopefully there is something in the new FileSecurity features
in .NET that does this a little smarter.

Any help would be greatly appreciated.

May 27 '06 #2

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

Similar topics

1
by: SPG | last post by:
Hi, I am relatively new to TOMCAT, and am trying to deploy a web app using it. I have a domain name that I want to use to access my web app directly. By default, I deploy my WAR, and it deploys...
2
by: Phil Ten | last post by:
Hello, I am working on a .NET C++ project based on the "Class Library (.NET)" wizard of Visual Studio .NET 2003. I would like to know if my .NET component is running in a ASP.NET page (.apsx...
4
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: ...
11
by: TheBurgerMan | last post by:
Hi all. I am using W2K3, .NET2 on a machine running AD and Exchange. I started getting the message below last week. I googled the error and not much was returned, but I did find this;...
4
by: Greg Allen | last post by:
I have a web service and am trying to use WSE 2.0 to pass attachments. I have enabled both the checkboxes in the WSE properties page in VS. The problem occurs when I try to get the...
3
by: namewitheldbyrequest | last post by:
"The XML element 'EnableTheming' from namespace 'http://tempuri.org/' is already present in the current scope" I created a Web Service: I imported System.Data.SqlClient so I could access SQL...
1
by: Jess Chadwick | last post by:
I am attempting to use the Enterprise Library (Jan 2006) Cryptography block to encrypt a credit card number in my ASP.NET 2.0 Commerce Server application. Everything is configured correctly, as...
8
by: rn5a | last post by:
I have a user control named Enter.ascx which has 2 TextBoxes. The 2 TextBoxes are named txt1 & txt2. The entire logic of this user control (like the properties of the 2 TextBoxes using set/get...
2
by: Dave | last post by:
After some digging, I discovered HttpContext.Current.Session is null when trying to access a session variable, username, in my upload.cs code which is in the App_Code folder. I just determined...
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,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.