Destination array is not long enough to copy all the required data. Check array length and offset

Aug 19, 2010 at 9:03 AM
I tried to delegate a dbuser with another dbuser from a web application, becouse my application wont use windows authentication at all i think it created the delegate becouse it did not give any error, but now from both code, or from mmc console i get this error when i try to view operation1's or app1's authorizations, "Destination array is not long enough to copy all the required data. Check array length and offset. Parameter name: binaryForm" The code i used to create the delegate is as below; string sqlConnectionString = "data source=.;initial catalog=netsqlazman;user id=sqlazman;password=sqlazman"; IAzManStorage storage = new SqlAzManStorage(sqlConnectionString); IAzManStore mystore = storage.GetStore("mystore"); IAzManApplication myapp = mystore.GetApplication(ASPxComboBox2.Text.ToString()); IAzManItem myop = myapp.GetItem(ASPxComboBox1.Text.ToString()); IAzManDBUser dbUser1 = storage.GetDBUser(ASPxTextBox1.Text.ToString()); IAzManDBUser dbUser2 = storage.GetDBUser(ASPxTextBox2.Text.ToString()); RestrictedAuthorizationType delegateAuthorization = RestrictedAuthorizationType.Allow; IAzManAuthorization del = myop.CreateDelegateAuthorization(dbUser1, dbUser2.CustomSid, delegateAuthorization, new DateTime(2010, 1, 1, 0, 0, 0), new DateTime(2010, 12, 31, 23, 59, 59)); dbuser1 is = user1 from db dbuser2 is = user2 from db ASPxComboBox2.Text.ToString() = "app1" ASPxComboBox1.Text.ToString() = "operation1"
Aug 19, 2010 at 6:49 PM

Hi,

When you create the delegateAuthorization use a WindowsIdentity SID for the authorization Owner.

myop.CreateDelegateAuthorization(dbUser1, dbUser2.CustomSid, delegateAuthorization, new DateTime(2010, 1, 1, 0, 0, 0),

myop.CreateDelegateAuthorization(dbUser1, new SqlAzManSID(WindowsIdentity.GetCurrent()), delegateAuthorization, new DateTime(2010, 1, 1, 0, 0, 0),