Click here to Skip to main content
15,892,575 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to do the delete function with control text Pin
steed leung12-Sep-06 22:29
steed leung12-Sep-06 22:29 
GeneralRe: How to do the delete function with control text Pin
Christian Graus12-Sep-06 22:43
protectorChristian Graus12-Sep-06 22:43 
GeneralRe: How to do the delete function with control text Pin
steed leung12-Sep-06 23:07
steed leung12-Sep-06 23:07 
GeneralRe: How to do the delete function with control text Pin
Christian Graus12-Sep-06 23:31
protectorChristian Graus12-Sep-06 23:31 
QuestionUSB & Serial Com Port Validation Pin
ASGuru12-Sep-06 21:36
ASGuru12-Sep-06 21:36 
QuestionSMTP file transfer Pin
krishna1912-Sep-06 21:12
krishna1912-Sep-06 21:12 
Questionfolder access writes Pin
chandler8312-Sep-06 21:03
chandler8312-Sep-06 21:03 
AnswerRe: folder access writes Pin
Niiiissssshhhhhuuuuu12-Sep-06 22:22
Niiiissssshhhhhuuuuu12-Sep-06 22:22 
Use public DirectorySecurity GetAccessControl ()

for eg;
using System;
using System.IO;
using System.Security.AccessControl;

namespace FileSystemExample
{
class DirectoryExample
{
public static void Main()
{
try
{
string DirectoryName = "TestDirectory";

Console.WriteLine("Adding access control entry for " + DirectoryName);

// Add the access control entry to the directory.
AddDirectorySecurity(DirectoryName, @"MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow);

Console.WriteLine("Removing access control entry from " + DirectoryName);

// Remove the access control entry from the directory.
RemoveDirectorySecurity(DirectoryName, @"MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow);

Console.WriteLine("Done.");
}
catch (Exception e)
{
Console.WriteLine(e);
}

Console.ReadLine();
}

// Adds an ACL entry on the specified directory for the specified account.
public static void AddDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);

// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();

// Add the FileSystemAccessRule to the security settings.
dSecurity.AddAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));

// Set the new access settings.
dInfo.SetAccessControl(dSecurity);

}

// Removes an ACL entry on the specified directory for the specified account.
public static void RemoveDirectorySecurity(string FileName, string Account, FileSystemRights Rights, AccessControlType ControlType)
{
// Create a new DirectoryInfo object.
DirectoryInfo dInfo = new DirectoryInfo(FileName);

// Get a DirectorySecurity object that represents the
// current security settings.
DirectorySecurity dSecurity = dInfo.GetAccessControl();

// Add the FileSystemAccessRule to the security settings.
dSecurity.RemoveAccessRule(new FileSystemAccessRule(Account,
Rights,
ControlType));

// Set the new access settings.
dInfo.SetAccessControl(dSecurity);

}
}
}

I hope this will help you

Cool | :cool: Cool | :cool:


<marquee>nishu
QuestionMp3 Tag Pin
pinebranch12-Sep-06 21:00
pinebranch12-Sep-06 21:00 
AnswerRe: Mp3 Tag Pin
Christian Graus12-Sep-06 21:05
protectorChristian Graus12-Sep-06 21:05 
QuestionConsole App Pin
Illegal Operation12-Sep-06 20:20
Illegal Operation12-Sep-06 20:20 
AnswerRe: Console App Pin
Christian Graus12-Sep-06 21:06
protectorChristian Graus12-Sep-06 21:06 
GeneralRe: Console App Pin
Illegal Operation12-Sep-06 22:37
Illegal Operation12-Sep-06 22:37 
GeneralRe: Console App Pin
Christian Graus12-Sep-06 22:46
protectorChristian Graus12-Sep-06 22:46 
AnswerRe: Console App Pin
Rick Crone13-Sep-06 11:23
Rick Crone13-Sep-06 11:23 
QuestionDeploy a dotnet application using Weblogic as the application server Pin
deldeep12-Sep-06 20:09
deldeep12-Sep-06 20:09 
AnswerRe: Deploy a dotnet application using Weblogic as the application server Pin
Christian Graus12-Sep-06 21:09
protectorChristian Graus12-Sep-06 21:09 
GeneralRe: Deploy a dotnet application using Weblogic as the application server Pin
deldeep15-Sep-06 8:33
deldeep15-Sep-06 8:33 
Questionhi, how can i read xmlnode in c#.net [modified] Pin
premkamalg12-Sep-06 20:02
premkamalg12-Sep-06 20:02 
AnswerRe: hi, how can i read xmlnode in c#.net Pin
Andrei Ungureanu12-Sep-06 20:14
Andrei Ungureanu12-Sep-06 20:14 
AnswerRe: hi, how can i read xmlnode in c#.net Pin
Christian Graus12-Sep-06 21:19
protectorChristian Graus12-Sep-06 21:19 
QuestionRe: hi, how can i read xmlnode in c#.net Pin
premkamalg13-Sep-06 1:09
premkamalg13-Sep-06 1:09 
AnswerRe: hi, how can i read xmlnode in c#.net Pin
Christian Graus13-Sep-06 10:29
protectorChristian Graus13-Sep-06 10:29 
GeneralHi,Christian,plz help me Pin
premkamalg13-Sep-06 17:50
premkamalg13-Sep-06 17:50 
GeneralRe: Hi,Christian,plz help me Pin
Christian Graus13-Sep-06 19:06
protectorChristian Graus13-Sep-06 19:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.