Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

ASP.NET - IO.Directory.CreateDirectory

[es] :: .NET :: ASP.NET :: ASP.NET - IO.Directory.CreateDirectory

[ Pregleda: 432 | Odgovora: 3 ]

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

vujkev
Darko Vujičić
Telekom Srbija AD
Beograd

Član broj: 8072
Poruke: 798
212.200.243.*

Sajt: www.suvu.co.yu


Profil

icon ASP.NET - IO.Directory.CreateDirectory09.03.2008. u 22:51

Imam jedan sajt u kom korisnik sam može da pravi svoje foldere. Foldere pravim sa .net komandom
Code:

IO.Directory.CreateDirectory(<path koji treba napraviti>)


problem koji imam je da od npr. 200 napravljenih foldera njih desetak ne nasleđuje prava pristupa od parent foldera. Do sad nisam uspeo da primetim neko pravilo kad se prava ne nasleđuju, pa vas pitam da li ste se susretali sa ovakvim problemom i da li znate kako da resim isti?

Naučio sam...
Da je važnije biti ljubazan nego biti u pravu
09.03.2008. u 22:51 

mmix
Miljan Mitrovic
Software Architect
Pancevo, Srbija

Moderator
Član broj: 17944
Poruke: 1793
195.252.78.*



Profil

icon Re: ASP.NET - IO.Directory.CreateDirectory10.03.2008. u 09:59
Da, to sam video na jos par mesta, i iskreno nemam pojma zasto se to desava, mozda je neki domain level policy umesao prste.
U svakom slucaju, imas mehanizam kojim mozes da korektujes situaciju:

Code:

DirectoryInfo dInfo = IO.Directory.CreateDirectory(<path koji treba napraviti>);
DirectorySecurity dSecurity = dInfo.GetAccessControl();
dSecurity.SetAccessRuleProtection(false, false);


ili

Code:

DirectorySecurity dSecurity = new DirectorySecurity();
dSecurity.SetAccessRuleProtection(false, false);
IO.Directory.CreateDirectory(<path koji treba napraviti>, dSecurity);



SetAccessRuleProtection je metod koji implementira ACL security inheritance flagove, prvi parametar = false znaci da directory treba da ima praznu ACL listu i da se ACL naseldjuje od parent containera.

▪ "Why isn't my wireless mouse connected to the computer?" - 2008 Dumbest Technical Support Question award
▪ The word 'politics' is derived from the word 'poly', meaning 'many', and the word 'ticks', meaning 'blood sucking parasites' - Larry Hardiman
▪ If the good guy gets the girl, it's rated PG; if the bad guy gets the girl, it's rated R; and if everybody gets the girl, it's rated X
10.03.2008. u 09:59 

vujkev
Darko Vujičić
Telekom Srbija AD
Beograd

Član broj: 8072
Poruke: 798
212.200.243.*

Sajt: www.suvu.co.yu


Profil

icon Re: ASP.NET - IO.Directory.CreateDirectory13.03.2008. u 20:10
A bio sam ubeđen da će ovo da radi

Citat:
Security Exception
Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file.

Exception Details: System.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.


Kako je ovaj sajt na GoDaddy-u nije mi jasno kako to drugi uspevaju da reše Koliko sam video jedino rešenje je da se u machine config fajlu poveća trust level kako bi ovo radilo.

Neko drugo rešenje ili da pišem administratorima?
Naučio sam...
Da je važnije biti ljubazan nego biti u pravu
13.03.2008. u 20:10 

mmix
Miljan Mitrovic
Software Architect
Pancevo, Srbija

Moderator
Član broj: 17944
Poruke: 1793
195.252.78.*



Profil

icon Re: ASP.NET - IO.Directory.CreateDirectory19.03.2008. u 11:34
Tesko ces moci da isposlujes tako nesto na shared serverima. Trust level je po defaultu omogucen, oni su ga namerno ukinuli, da bi zastitili ostale sajtove na shared serveru od jednom malicioznog posto verovatno sve sajtove ganjanju pod istim poolom lenjo, sta ces. Kad bi ti dali FileIO mogao bi da pobrises ostale sajtove na serveru

Sajtovi koji barataju ovakvim stvarima su obicno na dedicated serverima, tama te pustaju da radis sta hoces posto samo sebe mozes da zakopas.

▪ "Why isn't my wireless mouse connected to the computer?" - 2008 Dumbest Technical Support Question award
▪ The word 'politics' is derived from the word 'poly', meaning 'many', and the word 'ticks', meaning 'blood sucking parasites' - Larry Hardiman
▪ If the good guy gets the girl, it's rated PG; if the bad guy gets the girl, it's rated R; and if everybody gets the girl, it's rated X
19.03.2008. u 11:34 

[es] :: .NET :: ASP.NET :: ASP.NET - IO.Directory.CreateDirectory

[ Pregleda: 432 | Odgovora: 3 ]

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.