27 Ağustos 2014 Çarşamba

Attempt by security transparent method to access security critical method failed.

Attempt by security transparent method 'package_block_control.SetInfo(Int32, System.String, System.String, System.String, System.String, Int32, System.String)' to access security critical method 'dsPackagesTableAdapters.tblPackagesTableAdapter..ctor()' failed.

Assembly 'App_Web_hvja3wp0, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model.  Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.


.NET 4.0 ve üstü site yayınlarında karşılaşılan bir durum:

Çözüm:


belirtilen FONKSİYON sütüne 

[SecuritySafeCritical]

Ekleyin, Örn:

 [SecuritySafeCritical]
    public void SetInfo(Int32 _SpecialOfferID, String _Resim, String _Detail, String _Country, String _ClassName, Int32 _OtelID , String _Style)
    
{
...
}

using System.Security;

Tanımınıda sayfaya ekleyin

Tamamdır.