no

How to Fix Securityexception

Recently I found myself in another shared hosting problem. Unfortunately, we are hosting our personalized-items/corporate give away website ...

Recently I found myself in another shared hosting problem. Unfortunately, we are hosting our personalized-items/corporate give away website + wedding invitation (www.kalidadprintsandfavors.com) in godaddy.com. And I've just added a new feature where viewers can download the pricelist: http://www.kalidadprintsandfavors.com/pages/price-list. To ease the development I've used DoddleReport downloaded from nuget. I've downloaded the complete package for MVC3, doddlereport, doddlereport.web, doddlereport.itextsharp which automatically include itextsharp. The problem is iTextSharp requires AllowPartiallyTrustedCallers. Godaddy + itextsharp is a fatal combination which throws:
System.Security.SecurityException: That assembly does not allow partially trusted callers.
   at DoddleReport.Web.ReportRouteConstraint.Match(HttpContextBase httpContext, Route route, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
   at System.Web.Routing.Route.ProcessConstraint(HttpContextBase httpContext, Object constraint, String parameterName, RouteValueDictionary values, RouteDirection routeDirection)
After reading several solutions on these problem none of them work. Most specifically I've tried downloading the latest codes from codeplex (on all 3 + itextsharp from sourceforge) and modify the AssemblyInfo.css. I've added the following attribute:
[assembly: AllowPartiallyTrustedCallers]
Then I set my .NET Trust Level to Medium level, you can change it by opening IIS Information Service. But still I have the same error. Looking for solution and testing locally I found out that setting my my >NET Trust Level to Full internal resolved the issue. So I found of a way on how to override this setting in web.config and found it (after system.web add the ff line):

    
    ...

And it worked perfectly.

Related

c# 5940401827986740159

Post a Comment Default Comments

5 comments

Petr Woody said...

Thank you. Good job ;)

El Cris said...

But, I don't wanna change my Trust Level :S

Anonymous said...

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using from an inherited configuration file.

Source Error:


Line 27:
Line 28:
Line 29:
Line 30:
Line 31:

Unknown said...

YepThat was it...Thanks

But one thing to note in the snippet, tags are case-sensitive.

It should be :

...

Unknown said...

it worked !

item