public void LoadConfiguration(XmlDocument configuration) { XmlReader reader = new XmlNodeReader(configuration.DocumentElement); System.Xml.Serialization.XmlSerializer ser = new XmlSerializer(typeof(SerializableConfiguration)); SerializableConfiguration config = (SerializableConfiguration)ser.Deserialize(reader); ConfStorage storage = ConfStorage.Load(config); Application["m_ConfStorage"] = storage; }
protected void btnConfigure_Click(object sender, EventArgs e) { try { lblError.Text = string.Empty; Stream stream = fileSelector.FileContent; System.Xml.Serialization.XmlSerializer ser = new XmlSerializer(typeof(SerializableConfiguration)); SerializableConfiguration config = (SerializableConfiguration)ser.Deserialize(stream); ConfStorage storage = ConfStorage.Load(config); Application["m_ConfStorage"] = storage; } catch (Exception exc) { lblError.Text = "Error: " + exc.Message; } }