public bool DisableRewriter(string configPath)
{
try
{
XmlDocument xDoc = new XmlDocument();
xDoc.Load(configPath);
if (xDoc != null)
{
System.Xml.XmlNode xRoot = xDoc.DocumentElement;
System.Xml.XmlNode xNode = xRoot.SelectSingleNode("//system.webServer/modules");
if (xNode != null)
{
bool isInstalled = false;
foreach (XmlNode n in xNode.ChildNodes)
{
if (n.Attributes["name"].Value == "ForumsReWriter")
{
xNode.RemoveChild(n);
isInstalled = true;
break;
}
}
if (isInstalled)
{
xDoc.Save(configPath);
}
}
}
return(true);
}
catch (Exception ex)
{
return(false);
}
}