Monday, April 24, 2006

How can I programmatically “grant permissions to a specific user to access a specific windows folder share”. using C#?
Using this library and the following code you can grant permissions to user for a folder share programmatically.
SecurityDescriptor desc = SecurityDescriptor.GetNamedSecurityInfo (

shareHandle,
SE_OBJECT_TYPE.SE_LMSHARE,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);
Dacl dacl = null;

if (desc == null)
{
desc = new SecurityDescriptor();
desc.AllocateAndInitializeSecurityDescriptor();
dacl = new Dacl();
}
else
{
dacl = desc.Dacl;
}

dacl.AddAce (new AceAccessAllowed (new Sid ("BUILTIN\\Administrators"), AccessType.GENERIC_ALL));
dacl.AddAce (new AceAccessAllowed (new Sid ("Everyone"),

AccessType.GENERIC_READ
AccessType.GENERIC_EXECUTE
AccessType.READ_CONTROL
AccessType.STANDARD_RIGHTS_READ));
desc.SetDacl(dacl);
desc.SetNamedSecurityInfo(faxShare,
SE_OBJECT_TYPE.SE_LMSHARE ,
SECURITY_INFORMATION.DACL_SECURITY_INFORMATION);

A web page needs a read-only TextBox, the value of which will be set by client-side JavaScript (that pops up a picklist and chooses a value…). Users should not be able to modify the TextBox contents directly. To disable user input, we tried setting the TextBox’s properties “ReadOnly=true” and separately “Enabled=false”. This worked in ASP.Net 1.1.
However, ASP.NET 2.0, a security enhancement was made so that changes to values in ReadOnly or Disabled TextBoxes are ignored; the original value, stored in ViewState is presented on the server.
What is a valid work-around for this situation?
We added the HTML attribute “ReadOnly” to the TextBox manually, using code like:
TextBox1.Attributes.Add("ReadOnly", "true");
This ended up working: it appears that the browser respects the HTML tag, and ASP.NET is tricked into thinking the control is not read only. Is this the best workaround, or is there a better hook?

In ASP.NET 2.0 when you are using ReadOnly property, user can’t enter anything in textbox by any wayTo restrict user entry you should use:
TextBox1.Attributes.Add("contentEditable", "false");


We are using Forms Authentication.It was working fine for us until we started using a load balancer with three IIS boxes. We are not setting an encryption key anywhere. We are using the encryption provided by ASP.NET 2.0 We are getting the following exception now. I believe it is failing when consecutive requests are going to different IIS boxes and the different IIS boxes are not sharing an encryption key. Any idea?
Good start to resolve this would be: How To: Configure MachineKey in ASP.NET 2.0
More:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000007.asp
What's New in ASP.NET Data Access
ASP.NET version 2.0 continues to offer managed data access using ADO.NET and managed classes for XML. But ASP.NET 2.0 also includes new features to make data access in Web pages easier to implement and manage.More: http://msdn2.microsoft.com/en-us/library/06t2w7da(VS.80).aspx


The Visual Studio 2005 Web Application Project Model
This is a new web project option for Visual Studio 2005 that provides the same conceptual web project approach as VS 2003 (a project file based structure where all code in the project is compiled into a single assembly) but with all the new features of VS 2005 (refactoring, class diagrams, test development, generics, etc) and ASP.NET 2.0 (master pages, data controls, membership/login, role management, Web Parts, personalization, site navigation, themes, etc). More: http://www.asp.net/webproject


Abortable thread pools
I want to share an excellent article on Abortable thread pools in March 2006 edition of MSDN mag.
http://msdn.microsoft.com/msdnmag/issues/06/03/NETMatters/