I plan to set up configuration keys for FormFields, QueryString parameters etc. In my web.config I have setting as follows:
<WhiteListPaametersGroup>
<WhiteListPaameters>
<FormField1>EVENTVALIDATION</FormField1>
<FormField2>VIEWSTATE</FormField2>
<FormField3>Button1</FormField3>
<QueryString1>firstname</QueryString1>
<QueryString2>lastname</QueryString2>
</WhiteListPaameters>
</WhiteListPaametersGroup>
Then in my code, I read the value as follows:
Dictionary<string, string> parameters = new Dictionary<string,string>();
foreach (XmlNode n in section.ChildNodes)
{
parameters.Add(n.Name, n.InnerText);
}
Is there a better way of storing this. Later on, I want to be able to go through dictionary like object, and be able to get settings for FormFields, Querystrings etc.
Please let me know if I could write it cleaner.
Thanks
No comments:
Post a Comment