473,668 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to read folder security

Can anyone post a code snippet on how to retrieve Permission information on
a Folder? (Visual Basic 2005)

There's lot's of information on how to set a permission, but I can't figure
out how to read them. I want to be able to return what Users and Groups
have what permissions on the folder. I'm not interested in the files
within, although I know that they may vary from the folder itself.

Thanks,

Phil Haddock
Mar 27 '06 #1
1 1756
It is a bit mask:
FileAttributes attributes = Directory.Attri butes;

//examples (C#)
//For VB.NET use And for the logical AND

bool isArchive = ((attributes & FileAttributes. Archive) ==
FileAttributes. Archive);
bool isCompressed = ((attributes & FileAttributes. Compressed) ==
FileAttributes. Compressed);
bool isEncrypted = ((attributes & FileAttributes. Encrypted) ==
FileAttributes. Encrypted);
bool isHidden = ((attributes & FileAttributes. Hidden) ==
FileAttributes. Hidden);
bool isNormal = ((attributes & FileAttributes. Normal) ==
FileAttributes. Normal);
bool isReadOnly = ((attributes & FileAttributes. ReadOnly) ==
FileAttributes. ReadOnly);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** ************
Think Outside the Box!
*************** ************
"Phil Haddock" wrote:
Can anyone post a code snippet on how to retrieve Permission information on
a Folder? (Visual Basic 2005)

There's lot's of information on how to set a permission, but I can't figure
out how to read them. I want to be able to return what Users and Groups
have what permissions on the folder. I'm not interested in the files
within, although I know that they may vary from the folder itself.

Thanks,

Phil Haddock

Mar 28 '06 #2

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

Similar topics

1
1336
by: SPM2 | last post by:
I have a database on one computer, and have the folder shared out. And I a have another computer linked to this database. But the problem I am having is that the 2nd computer when opening the database says that it is read-only. I check the folder and it is saying read-only. I fix this and then again when trying to access it, it is read only again. I'm not quite sure what the problem is. Any help would be greatly appreciated. Thanks
4
2094
by: Miro | last post by:
Hello! I have an ASP.NET application which needs to read some data from an Access database on Novell. I've found an article on Microsoft and did the following: I've created an account on Novell (IUSR_Machinename) which is the same account that the aspx is using. This account has full rights to the database and the folder (on Novell). I've mapped the folder in explorer but when I try to access the database from ASP.NET I get these...
3
4003
by: Dave Coate | last post by:
Hello again, I am going to re-post a question. I got some excellent suggestions from Rob and Mattias on this but their ideas did not solve the problem. Here is the original post: ***************************************************** I am looking for a way to 'override' file security and read the Owner of a file to which I have no access. I am a system administrator, as such I have administrative rights to all the computers in the...
5
13293
by: Mitchell S. Honnert | last post by:
Is there a way, given the full path of a folder on a network, that one can programatically tell if you have Read access to that folder? I have an application where the user is able to select a number of search folders using the standard dialog control. There shouldn't be an issue with the search folder being on a local drive or a network drive. But if you don't have Read access to the folder, there's trouble. The user can see the...
2
4359
by: keithb | last post by:
This is on a remote server. Everything works in the development envirmonment. Any ideas? Thanks, Keith Failed to update database "C:\BTM_ROOT\APP_DATA\ASPNETDB.MDF" because the database is read-only. Description: An unhandled exception occurred during the execution of the
3
1854
by: jao.sanien | last post by:
Hi I have a access file that need to be made to read only. And the file should be password protected if I want to edit something. So those who doesn't have the password can only read. I don't know access at all so I don't have a clue help pls Many thanks
3
4817
by: James Maeding | last post by:
I am familiar with using My.Computer.FileSystem.GetDirectoryInfo to get folder attributes, see code below... This does not work though for network drives on my companies system. We use windows as our server, nothing exotic. I looked at the security permissions and the "write" box for domain users was grey, but not checked. This means read-only to me and sure enough, I cannot change the files. Is there a different way to deal with...
2
10690
by: Bill Fallon | last post by:
I have a VS2005 VB.Net windows form application deployed to a share drive. The windows explorer security permissions for this application (.exe) file is set for Everyone with List Folder/Read Data not allowed. This is done so that users cannot take away a copy of the .exe file. When I execute the ..exe from the client computer I get .Net Framework Initialization Error, Unable to find a version of the runtime to run this application. The...
8
3864
by: paquer | last post by:
Database Users need to have Read/Write etc... permissions to the folder where the Database resides in order to create the lock file. I have read only users. I have set up the Shortcut that links to the 'Workgroup Info File' with permissions for said database. Within this 'WIF' File I have "Read Only" user's who are only provided access to the DB only so they can view the data. Now if I give them full permissions to the folder where...
4
11830
by: Jim | last post by:
I have the following piece of code: Directory.CreateDirectory(myDir); DirectoryInfo lDir = new DirectoryInfo(myDir); lDir.Attributes = FileAttributes.Normal; When this code runs, my directory is created fine, but my directory is always read only. At first I thought it was something with using DirectoryInfo. However, I also ran the following line of code:
0
8459
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8374
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8791
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8575
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8653
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7398
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4202
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1783
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.