Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
Question"Jumper" form Pin
The Brazilian One1-Feb-07 1:19
The Brazilian One1-Feb-07 1:19 
AnswerRe: "Jumper" form Pin
Parwej Ahamad1-Feb-07 1:23
professionalParwej Ahamad1-Feb-07 1:23 
AnswerRe: "Jumper" form Pin
aSarafian1-Feb-07 2:09
aSarafian1-Feb-07 2:09 
AnswerRe: "Jumper" form Pin
bobsugar2221-Feb-07 2:43
bobsugar2221-Feb-07 2:43 
QuestionSave a 4bpp Bitmap Pin
JoeSharp1-Feb-07 0:59
JoeSharp1-Feb-07 0:59 
AnswerRe: Save a 4bpp Bitmap Pin
Luc Pattyn1-Feb-07 2:07
sitebuilderLuc Pattyn1-Feb-07 2:07 
Questionhow to set password on my Sql2005 express database ? Pin
hdv2121-Feb-07 0:04
hdv2121-Feb-07 0:04 
QuestionPlz help me on programmatically set NTFS file system folder permissions Pin
Sanjib Raj31-Jan-07 23:49
Sanjib Raj31-Jan-07 23:49 
i have programmatically set NTFS file system folder permissions by using Active Directory Service Interfaces in Microsoft Visual C#.the problem is that i give permissions through Mohana//administrator(Domin/User) to (C:\\Test) Folder. the program works but when i right click the test folder goto Security Tab it create another user (BUILTIN//BUILTIN)and give All permition to it. i want all permission to administrator. Plz help me.
...code....

using System;
using System.Security;
using ADSSECURITYLib;
using ActiveDs;

namespace SecurityFolder
{

public class clsSecurity
{
public clsSecurity()
{

}
public void preformAction()
{

// Set <domain> to your domain name.
// Set <username> to the user account.
SetPermissions("C:\\Test","MOHANA\\administrator");
Console.WriteLine ("Full Access control granted.");

}

public void SetPermissions(string vPath, String UserName )
{
ADsSecurity objADsSec;
SecurityDescriptor objSecDes;
AccessControlList objDAcl;
AccessControlEntry objAce1;
AccessControlEntry objAce2;
Object objSIdHex;
ADsSID objSId;
string mes;
objADsSec = new ADsSecurityClass();
objSecDes = (SecurityDescriptor)(objADsSec.GetSecurityDescriptor("FILE://"+vPath));
//objSecDes=(SecurityDescriptor)objADsSec.GetSecurityDescriptor(vPath);
objDAcl = (AccessControlList)objSecDes.DiscretionaryAcl;

objSId = new ADsSIDClass();
objSId.SetAs((int)ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SAM, UserName.ToString());
objSIdHex = objSId.GetAs((int)ADSSECURITYLib.ADS_SID_FORMAT.ADS_SID_SDDL);

// Add a new access control entry (ACE) object (objAce) so that the user has Full Control permissions on NTFS file system files.
objAce1 = new AccessControlEntryClass();
objAce1.Trustee = System.Convert.ToString (objSIdHex);
objAce1.AccessMask = (int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_ALL;
objAce1.AceType = (int)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ALLOWED;
objAce1.AceFlags = (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ACE | (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ONLY_ACE | 1;
objDAcl.AddAce(objAce1);

// Add a new access control entry object (objAce) so that the user has Full Control permissions on NTFS file system folders.
objAce2 = new AccessControlEntryClass();
objAce2.Trustee = System.Convert.ToString (objSIdHex);
objAce2.AccessMask = (int)ActiveDs.ADS_RIGHTS_ENUM.ADS_RIGHT_GENERIC_ALL;
objAce2.AceType = (int)ActiveDs.ADS_ACETYPE_ENUM.ADS_ACETYPE_ACCESS_ALLOWED;
objAce2.AceFlags = (int)ActiveDs.ADS_ACEFLAG_ENUM.ADS_ACEFLAG_INHERIT_ACE | 1;
objDAcl.AddAce(objAce2);

objSecDes.DiscretionaryAcl = objDAcl;

// Set permissions on the NTFS file system folder.
objADsSec.SetSecurityDescriptor(objSecDes, "FILE://"+vPath);
}
}
}

Sanjit.rajbanshi@wlinktech.com
AnswerRe: Plz help me on programmatically set NTFS file system folder permissions Pin
bobsugar2221-Feb-07 0:46
bobsugar2221-Feb-07 0:46 
QuestionInvoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:06
kalyan_241631-Jan-07 23:06 
AnswerRe: Invoking exe file through asp.net Pin
Pete O'Hanlon31-Jan-07 23:11
mvePete O'Hanlon31-Jan-07 23:11 
GeneralRe: Invoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:24
kalyan_241631-Jan-07 23:24 
GeneralRe: Invoking exe file through asp.net Pin
Pete O'Hanlon1-Feb-07 0:22
mvePete O'Hanlon1-Feb-07 0:22 
AnswerRe: Invoking exe file through asp.net Pin
Colin Angus Mackay31-Jan-07 23:11
Colin Angus Mackay31-Jan-07 23:11 
AnswerRe: Invoking exe file through asp.net Pin
led mike1-Feb-07 4:40
led mike1-Feb-07 4:40 
GeneralRe: Invoking exe file through asp.net Pin
kalyan_241631-Jan-07 23:25
kalyan_241631-Jan-07 23:25 
QuestionErrors with book example program Pin
Lurker0031-Jan-07 23:02
Lurker0031-Jan-07 23:02 
AnswerRe: Errors with book example program Pin
Colin Angus Mackay31-Jan-07 23:10
Colin Angus Mackay31-Jan-07 23:10 
GeneralRe: Errors with book example program Pin
Lurker0031-Jan-07 23:19
Lurker0031-Jan-07 23:19 
AnswerRe: Errors with book example program Pin
Stefan Troschuetz31-Jan-07 23:18
Stefan Troschuetz31-Jan-07 23:18 
GeneralRe: Errors with book example program Pin
Lurker0031-Jan-07 23:36
Lurker0031-Jan-07 23:36 
GeneralRe: Errors with book example program Pin
Russell Jones1-Feb-07 0:23
Russell Jones1-Feb-07 0:23 
AnswerRe: Errors with book example program Pin
bobsugar2221-Feb-07 2:14
bobsugar2221-Feb-07 2:14 
GeneralRe: Errors with book example program Pin
Lurker001-Feb-07 17:31
Lurker001-Feb-07 17:31 
Questionhow to assign a null value to an int Pin
quiteSmart31-Jan-07 22:59
quiteSmart31-Jan-07 22:59 

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.