Reputation: 1153
We can retrieve configuration sections from web.config in the following two ways:
Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
AuthenticationSection authSection = (AuthenticationSection)
config.GetSection(@"system.web/authentication");
OR
AuthenticationSection authSection = (AuthenticationSection)
WebConfigurationManager.GetSection(@"system.web/authentication");
How are the two approaches different ( besides the fact that in the first example we retrieved a configuration section via Configuration object, which represents a configuration file )?
thanx
Upvotes: 1
Views: 531
Reputation: 37543
You didn't use 2 different approaches. If you look carefully your statements are almost identical. The only minor difference is that in the second one the Open statement is implied and automated through the object. They both do the same thing the same exact way.
Upvotes: 2