我打算設置爲FormFields配置鍵,查詢字符串參數等。在我的web.config我已經設置如下:自定義配置XML設置並存儲到字典對象
<WhiteListPaametersGroup>
<WhiteListPaameters>
<FormField1>EVENTVALIDATION</FormField1>
<FormField2>VIEWSTATE</FormField2>
<FormField3>Button1</FormField3>
<QueryString1>firstname</QueryString1>
<QueryString2>lastname</QueryString2>
</WhiteListPaameters>
</WhiteListPaametersGroup>
然後在我的代碼,我讀取值如下:
Dictionary<string, string> parameters = new Dictionary<string,string>();
foreach (XmlNode n in section.ChildNodes)
{
parameters.Add(n.Name, n.InnerText);
}
有沒有更好的存儲方式。稍後,我希望能夠像字典一樣查看字典,並且能夠獲得FormFields,Querystrings等的設置。
請讓我知道我是否可以寫得更清潔。
感謝
如果你使用的是vs2010,看看這個擴展,其驚人的:http://visualstudiogallery.msdn.microsoft.com/def289f1-377d-4cd0-802a-80c8be8b6758 – asawyer 2012-04-20 22:17:54