System.Web.Configuration.WebConfigurationManager.GetWebApplicationSection C# (CSharp) Method

GetWebApplicationSection() public static method

public static GetWebApplicationSection ( string sectionName ) : object
sectionName string
return object
		public static object GetWebApplicationSection (string sectionName)
		{
			HttpContext ctx = HttpContext.Current;
			HttpRequest req = ctx != null ? ctx.Request : null;
			string applicationPath = req != null ? req.ApplicationPath : null;
			return GetSection (sectionName, String.IsNullOrEmpty (applicationPath) ? String.Empty : applicationPath);
		}

Usage Example

Example #1
0
            private static void EnsureSectionLoaded()
            {
                if (!s_sectionLoaded)
                {
                    ScriptingScriptResourceHandlerSection section = (ScriptingScriptResourceHandlerSection)
                                                                    WebConfigurationManager.GetWebApplicationSection("system.web.extensions/scripting/scriptResourceHandler");

                    if (section != null)
                    {
                        s_enableCaching     = section.EnableCaching;
                        s_enableCompression = section.EnableCompression;
                    }
                    else
                    {
                        s_enableCaching     = (bool)_propEnableCaching.DefaultValue;
                        s_enableCompression = (bool)_propEnableCompression.DefaultValue;
                    }

                    s_sectionLoaded = true;
                }
            }
All Usage Examples Of System.Web.Configuration.WebConfigurationManager::GetWebApplicationSection