Fixed: Exception "This document already has a DocumentElement node"

Work Items: 29412
This commit is contained in:
starfighter83
2011-01-07 09:56:19 -01:00
parent d182a297b8
commit 7d69bed9c9

View File

@@ -32,31 +32,40 @@ namespace umbraco.cms.businesslogic.web
_checkedPages.Clear();
}
static object _locko = new object();
public static XmlDocument AccessXml
{
get {
if (_accessXmlContent == null)
{
if (_accessXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_accessXmlSource = IOHelper.MapPath(SystemFiles.AccessXml, false);
}
get
{
if (_accessXmlContent == null)
{
lock (_locko)
{
if (_accessXmlContent == null)
{
if (_accessXmlSource == null)
{
//if we pop it here it'll make for better stack traces ;)
_accessXmlSource = IOHelper.MapPath(SystemFiles.AccessXml, false);
}
_accessXmlContent = new XmlDocument();
_accessXmlContent = new XmlDocument();
if (!System.IO.File.Exists(_accessXmlSource))
{
System.IO.FileStream f = System.IO.File.Open(_accessXmlSource, FileMode.Create);
System.IO.StreamWriter sw = new StreamWriter(f);
sw.WriteLine("<access/>");
sw.Close();
f.Close();
}
_accessXmlContent.Load(_accessXmlSource);
}
return _accessXmlContent;
}
if (!System.IO.File.Exists(_accessXmlSource))
{
System.IO.FileStream f = System.IO.File.Open(_accessXmlSource, FileMode.Create);
System.IO.StreamWriter sw = new StreamWriter(f);
sw.WriteLine("<access/>");
sw.Close();
f.Close();
}
_accessXmlContent.Load(_accessXmlSource);
}
}
}
return _accessXmlContent;
}
}
public static void AddMembershipRoleToDocument(int documentId, string role) {