2014-04-21 39 views
-2

儘管通讀C#config節,上午線得到一個錯誤的第一節如何讀取配置文件從C#代碼

The application relative virtual path '~' is not allowed here.

System.Configuration.Configuration config = 
    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); 
SystemWebSectionGroup grp = (SystemWebSectionGroup)config.GetSectionGroup("system.web"); 
+0

你可以顯示配置文件中的部分是什麼樣子 – MethodMan

回答