How to solve the medium trust problem in asp.net

6

I'm developing a website in Asp.Net MVC5. When I publish the site in LocaWeb and try to login with my user I received the message:

Attempt by security transparent method 'Microsoft.AspNet.Identity.ClaimsIdentityFactory'2+<CreateAsync>d__0<TUser,TKey>.MoveNext()' to access security critical method 'System.Security.Claims.ClaimsIdentity.AddClaim(System.Security.Claims.Claim)' failed.

Assembly 'Microsoft.AspNet.Identity.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is partially trusted, which causes the CLR to make it entirely security transparent regardless of any transparency annotations in the assembly itself.  In order to access security critical code, this assembly must be fully trusted.

I use Identity and also some DevExpress components.

It was only then that I contacted the support that told me that the problem occurs because their server only runs on medium trust: link

On the microsoft site says that the solution is to put inside the <System.web> tag of my web.config the <trust level="medium" originUrl="" /> tag.

When doing this I get the following server error: This configuration section cannot be used at this path. This happens when the site administrator has locked access to this section using <location allowOverride="false"> from an inherited configuration file.

That is, locaweb blocked this change through a global configuration file (at least that's what I understood from the error). I already tried to tag the <location allowOverride="false"> tag but it also did not work.

The locaweb support only knows that the error is programming, but I do not know how to solve it. Does anyone here know how to solve this?

    
asked by anonymous 30.05.2014 / 03:38

1 answer

1

I've had a similar problem. Some Host does not even allow. Try a test in Windows Azure: link

My latest projects have been using Azure as a host, now they have servers in Brazil as well.

    
01.07.2014 / 00:09