Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Calling Norway
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
01432969
Message ID:
01435387
Vues:
39
>>I am addressing this post directly to Norwegian developers, but writing in english so others can read it (and it just takes a lot longer to write in norwegian).
>>
>>I have posted about this issue in the past but had no replies.
>>
>>I first encountered this exception on a norwegian pc running Windows with Norwegian language package.
>>
>>The exception is in Norwegian:
>>Noen eller all identitetsreferanser kan ikke oversettes.
>>
>>But I have also seen the exception in english (I think on a danish PC and/or french PC)
>>Some or all identity references could not be translated.
>>
>>I am not sure where this beeing thrown from and I can't reproduce it on my computer. My app only seem to throw this exception on computers with French, Norwegian or Danish language package for Windows.
>>
>>Any help on this would be great.
>>
>>You can reply in norwegian if you want to.
>>
>>Thanks,
>>Einar
>
>I finnaly got a hold of a Swedish laptop where I could generate the exception. The following code throws the exception mentioned above:
>
>        public static void AddFolderAccess(string path, string identity)
>        {
>            DirectorySecurity directorySecurity = Directory.GetAccessControl(path);
>            FileSystemAccessRule fileSystemAccessRule = new FileSystemAccessRule
>                (identity
>                , FileSystemRights.Modify
>                , InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit
>                , PropagationFlags.None
>                , AccessControlType.Allow);
>
>            directorySecurity.AddAccessRule(fileSystemAccessRule);
>            Directory.SetAccessControl(path, directorySecurity);
>        }
>
>
>If anyone (not only norwegian developers) can help me shed some light on this that would be great.
>
>Thanks,
>Einar

Have you tried using an overload of the FileSystemAccessRule that takes an IdentityReference instead of the string representing the identity?

Not tested:
SecurityIdentifier si = new SecurityIdentifier(WellKnownSidType.NetworkServiceSid , null);

DirectorySecurity directorySecurity = Directory.GetAccessControl(Path);
FileSystemAccessRule fileSystemAccessRule = new FileSystemAccessRule(si.Translate(typeof(NTAccount))
                            , FileSystemRights.Modify
                            , InheritanceFlags.ContainerInherit  | InheritanceFlags.ObjectInherit
                            , PropagationFlags.None
                            , AccessControlType.Allow);

...
I think the names used for Local Service, Network Service, and Local System are different in different languages. Like NT AUTHORITYLOCAL SERVICE versus AUTORITE NTSERVICE LOCAL, etc...

http://msdn.microsoft.com/en-us/library/214122bs(VS.80).aspx

(I"m currently testing something similar)
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform