That assembly does not allow partially trusted callers.

JustAskMe
JustAskMe used Ask the Experts™
on
I changed hosting to godady, I uploaded the same files I used on other hosts, now on one page I get this error:

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: That assembly does not allow partially trusted callers.
Stack Trace:

[SecurityException: That assembly does not allow partially trusted callers.]
   ASP.checkoutnormal_aspx.__BuildControlbtnBuyNow() in d:\hosting\5495357\html\Checkoutnormal.aspx:930
   ASP.checkoutnormal_aspx.__BuildControlpnlOrderReview() in d:\hosting\5495357\html\Checkoutnormal.aspx:785
   ASP.checkoutnormal_aspx.__BuildControlcontentCheckOut(Control __ctrl) in d:\hosting\5495357\html\Checkoutnormal.aspx:5
   System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
   ASP.masterpage_master.__BuildControlcontentMasterPage() in d:\hosting\5495357\html\MasterPage.master:51
   ASP.masterpage_master.__BuildControlform1() in d:\hosting\5495357\html\MasterPage.master:37
   ASP.masterpage_master.__BuildControlTree(masterpage_master __ctrl) in d:\hosting\5495357\html\MasterPage.master:1
   ASP.masterpage_master.FrameworkInitialize() in d:\hosting\5495357\html\MasterPage.master.cs:912308
   System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8670655
   System.Web.UI.Page.get_Master() +51
   Aivea_Eshop_Storefront.Checkoutnormal.get_Master() in App_Web_checkoutnormal.aspx.cdcab7d2.s6num4_p.0.cs:0
   Aivea_Eshop_Storefront.Checkoutnormal.OnPreInit(EventArgs e) in d:\hosting\5495357\html\Checkoutnormal.aspx.cs:2261
   System.Web.UI.Page.PerformPreInit() +31
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
   System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
   System.Web.UI.Page.ProcessRequest() +80
   System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
   System.Web.UI.Page.ProcessRequest(HttpContext context) +49
   ASP.checkoutnormal_aspx.ProcessRequest(HttpContext context) in App_Web_checkoutnormal.aspx.cdcab7d2.s6num4_p.0.cs:0
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Miguel OzSenior Software Engineer
Top Expert 2009

Commented:
your webserver configuration should allow partial trusted assemblies.
Check:
http://msdn2.microsoft.com/en-us/library/wyts434y.aspx
http://forums.asp.net/t/1224321.aspx

Author

Commented:
Thanks for the links.

I called goDady they said that they don't change security levels.

My question is if its possible to add any value to the .config to allow it?
You can set [assembly: AllowPartiallyTrustedCallers()] attribute in any assemblies you are using. I am hoping you are not using any third party DLLs which are causing this issue.

If you have any third party DLL and it's open source , download the source and set this attribute , recompile it and readd reference into your project.

This should work as far as I see that. I had the similar issue with GoDaddy recently. I was having issues with some of my DLLs and EnterPriseLibrary 3.1 dlls.

Hope it helps
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
what do you mean in each assemblies its one web site that's compiled on the go so i have only one AssemblyInfo.cs file, I added this [assembly: AllowPartiallyTrustedCallers()] but didn't help.
Do you have any third party assemblies referenced to your web project/site ? Can you go to AssemblyInfo.cs files of those Assembly projects and do the same modification ?

Author

Commented:
Yes I have a few dll's in this form, and I can't change it.

so there's no way to make it work on godady?
Senior Software Engineer
Top Expert 2009
Commented:
Chinu 1210 and I did the right recommendations. Unfortunately the user have infrastructure and third party assemblies limitations. There is no way around them, thus justaskme can not use godady as provider.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial