ASP.NET 2.0, AllowPartiallyTrustedCallers ed il medium trust

Daniele Bochicchio

di Daniele Bochicchio, in ASP.NET, venerdì 30 giugno 2006 ore 11.30

Archiviato in: , ,

Sembra che ci sia problemi, giustamente, se si utilizza il CodeFile con ASP.NET 2.0 in un ambiente dove il trust è stato abbassato su medium.

Potremmo disquisire per ore sul perchè questo, alla fine, non serve praticamente a nulla per la sicurezza (basta scrivere un q.sa di unmanaged per usare i privilegi del processo e non quelli derivanti da CAS...), ma fatto sta che in questi giorni un po' di persone mi hanno portato l'orecchio questo problema.

Detto ciò, la soluzione è la seguente. Installarsi Web Application Projects. Riporterà il modello del CodeBehind, con conseguente compilazione dell'assembly in un solo file. Poi utilizzare l'attributo AllowPartiallyTrustedCallers:

<Assembly: AllowPartiallyTrustedCallers()>

Fatto questo, è sufficiente compilare tutto in un solo assembly e fare il deployment di quest'ultimo.

In alternativa, c'è anche la voce "Publish" sotto il menu "Build" che potrebbe fare al caso vostro, magari con Web Deploymnet Projects per compilare tutto (anche file sotto /App_Code/) in un solo assembly, anzichè farlo fare ad ASP.NET.

Commenti

Per inserire un commento, devi avere un account.

Fai il login e torna a questa pagina, oppure registrati alla nostra community.



Segnala su: Facebook MSDN Social Twitter Segnalo Wikio Diggita Technorati Stumbleupon Google Yahoo FriendFeed Delicious Furl

Nella stessa categoria
I più letti del mese
TagCloud
.NET Framework, .NET Framework 2.0, .NET Framework 3.0, .NET Framework 3.5, .NET Framework 4.0, 10annidi, ADO.NET, ADO.NET Data Services, ADO.NET Entity Framework, AJAX, Architettura, ASP, ASP.NET, ASP.NET 2.0, ASP.NET 2.0 per tutti, ASP.NET 3.5, ASP.NET 3.5 per tutti, ASP.NET 4.0, ASP.NET AJAX, ASP.NET Charting, ASP.NET MVC, ASPItalia.com, Cache, CSS, Custom Control, Database, Databinding, Datagrid, Deployment, Dynamic Data Control, HttpHandler, HttpModule, HttpRuntime, IIS, ISAPI, Javascript, LINQ, LINQ to Entities, LINQ to SQL, LogParser, Master Pages, Media Center, Membership API, Microsoft Expression, Mono, MySQL, Object Oriented Programming, Off Topic, Office, ORM, Pattern, PDC 2008, Profile API, Provider Model, Report, Roles API, Security, Silverlight, Silverlight 2.0, Silverlight 3.0, SQL Server, User Control, Visual Studio, Web Service, Windows 7, Windows CardSpace, Windows Client, Windows Communication Foundation, Windows Live Services, Windows Mobile, Windows Presentation Foundation, Windows Server, Windows Vista, WinFS, XAML, XBox 360, XHTML, XML, XSLT
BLOG INFO
  • 889 post, 388 commenti, 187 trackback
  • Feed blog e contenuti tecnici: RSS
  • Feed blog: RSS Atom
IN EVIDENZA