1
我們可以從web.config中有以下兩種方式檢索配置部分:通過WebConfigurationManager和配置檢索配置部分對象
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
AuthenticationSection authSection = (AuthenticationSection)
config.GetSection(@"system.web/authentication");
OR
AuthenticationSection authSection = (AuthenticationSection)
WebConfigurationManager.GetSection(@"system.web/authentication");
如何是不同的兩種方法(除事實上,在第一個例子中,我們通過配置對象檢索了一個配置節,它代表了一個配置文件)?
thanx
我認爲也許有不同從哪個web.config文件的身份驗證部分檢索。在第一種情況下,它從根web.config中檢索,但在第二種情況下,它可能會從其他一些應用程序的Web檢索.config文件(如果存在) – carewithl 2010-01-30 19:48:03
它們都打開當前應用程序的默認web.config(基於現有文件夾),從根開始並搜索system.web/authentication。 – 2010-01-30 19:50:47
thanx幫助我 – carewithl 2010-01-31 18:48:41