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