U4-1897 - 'umbraco.GlobalSettings.UseMediumTrust' is obsolete: '"This property is no longer used and will be removed in future versions"

Created by Mike Chambers 12 Mar 2013, 12:44:49 Updated by esunxray 26 Sep 2013, 07:28:02

Subtask of: U4-2288

  • This property is removed in v7

Just wondering what the recommended approach is now..

Searching the current source... umbracoUseMediumTrust doesn't seem to be used in any source file.. apart from the osolete umbraco.buisnesslogic/globalsettings.cs

There is a Umbraco.Core.Configuration/Globalsettings.cs but that has private members and no longer has the UseMediumTrust anyway??

Is everything supposed to be mediumtrust safe so there is no need for this flag and the setting in the web.config has no use?

Comments

Sebastiaan Janssen 12 Mar 2013, 13:29:43

Indeed. :-) Will remove in v7 so we don't break backwards compatibility in a minor/patch release.


Mike Chambers 12 Mar 2013, 13:39:01

hmmm./.. would that break a lot of packages that might be using the flag to code full vs medium trust?

ones that I have especially come across are the use of the System.Web.Configuration.WebConfigurationManager, which requires full trust and having to revert to xml manipulation for medium trust.. but if full trust is available then the webConfiguartionManager is the better implementation?

ps the about umbraco button in the admin still fails in medium trust... trying to read the version from the dll :-) not a good advert for mediumtrust safe ;-)


Sebastiaan Janssen 12 Mar 2013, 13:58:37

Mike: Maybe, I don't think anybody is using it particularly as they should be reading the key instead.

Ah, really? I never click that one.. ;-) Make sure to create another issue for the About button please. :)


Mike Chambers 12 Mar 2013, 14:02:30

reading the trust key, from the web.config?

if you mean the trust key in the web.config then that could be problematic... for rackspace cloud for instance there is no trust key as they set at the application config level... and including a trust node causes an error as they expressively forbid it.


Sebastiaan Janssen 12 Mar 2013, 14:17:32

Ah, well, I was wrong on that one :-)

Here's how to do it properly:

http://stackoverflow.com/questions/1064274/get-current-asp-net-trust-level-programmatically


Mike Chambers 13 Mar 2013, 22:01:18

not disimilar to the old method in obsolete globalSettings.cs :-) just lifted that into my own class library.

public static bool UseMediumTrust { get { try { var trustLevel = SystemUtilities.GetCurrentTrustLevel(); if (trustLevel == AspNetHostingPermissionLevel.High || trustLevel == AspNetHostingPermissionLevel.Unrestricted) return false; else return bool.Parse(ConfigurationManager.AppSettings["umbracoUseMediumTrust"]); } catch { return false; } } }


Shannon Deminick 26 Sep 2013, 02:22:54

we have this in the core:

Umbraco.Core.SystemUtilities.GetCurrentTrustLevel()

to get the current trust level which works in med trust.


esunxray 26 Sep 2013, 07:28:02

V7 is a very nice chance to clean up the code.


Priority: Normal

Type: Bug

State: Fixed

Assignee:

Difficulty: Normal

Category:

Backwards Compatible: False

Fix Submitted:

Affected versions: 4.11.5, 4.11.6

Due in version: 7.0.0

Sprint:

Story Points:

Cycle: