using System;
using System.Configuration;
using System.Xml;
using System.Xml.Serialization;
using System.Xml.XPath;
namespace URLRewriter.Config
{
///
/// Deserializes the markup in Web.config into an instance of the class.
///
public class RewriterConfigSerializerSectionHandler : IConfigurationSectionHandler
{
///
/// Creates an instance of the class.
///
/// Uses XML Serialization to deserialize the XML in the Web.config file into an
/// instance.
/// An instance of the class.
public object Create(object parent, object configContext, System.Xml.XmlNode section)
{
// Create an instance of XmlSerializer based on the RewriterConfiguration type...
XmlSerializer ser = new XmlSerializer(typeof(RewriterConfiguration));
// Return the Deserialized object from the Web.config XML
return ser.Deserialize(new XmlNodeReader(section));
}
}
}