Fixed GlobalSettings.SaveSetting handler for Medium Trust.
[TFS Changeset #71100]
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Configuration;
|
||||
using System.Xml;
|
||||
|
||||
@@ -248,17 +249,21 @@ namespace umbraco
|
||||
{
|
||||
WebConfigurationFileMap webConfig = new WebConfigurationFileMap();
|
||||
var vDirs = webConfig.VirtualDirectories;
|
||||
var vDir = "~";
|
||||
var vDir = FullpathToRoot;
|
||||
foreach (VirtualDirectoryMapping v in webConfig.VirtualDirectories)
|
||||
{
|
||||
if (v.IsAppRoot)
|
||||
{
|
||||
vDir = v.VirtualDirectory;
|
||||
vDir = v.PhysicalDirectory;
|
||||
}
|
||||
}
|
||||
Configuration config = WebConfigurationManager.OpenWebConfiguration(vDir);
|
||||
config.AppSettings.Settings[key].Value = value;
|
||||
config.Save();
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(String.Concat(vDir, "web.config"));
|
||||
XmlNode root = doc.DocumentElement;
|
||||
XmlNode setting = doc.SelectSingleNode(String.Concat("//appSettings/add[@key='", key, "']"));
|
||||
setting.Attributes["value"].InnerText = value;
|
||||
doc.Save(String.Concat(vDir, "web.config"));
|
||||
ConfigurationManager.RefreshSection("appSettings");
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
<Project>{511F6D8D-7717-440A-9A57-A507E9A8B27F}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
</ProjectReference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\LinqToUmbraco\src\umbraco.Linq\Solution Items\SolutionInfo.cs">
|
||||
|
||||
Reference in New Issue
Block a user