コード例 #1
0
        internal static CustomErrorsSection GetSettings(HttpContext context, bool canThrow)
        {
            CustomErrorsSection ce            = null;
            RuntimeConfig       runtimeConfig = null;

            if (canThrow)
            {
                runtimeConfig = RuntimeConfig.GetConfig(context);
                if (runtimeConfig != null)
                {
                    ce = runtimeConfig.CustomErrors;
                }
            }
            else
            {
                runtimeConfig = RuntimeConfig.GetLKGConfig(context);
                if (runtimeConfig != null)
                {
                    ce = runtimeConfig.CustomErrors;
                }
                if (ce == null)
                {
                    if (_default == null)
                    {
                        _default = new CustomErrorsSection();
                    }

                    ce = _default;
                }
            }

            return(ce);
        }
コード例 #2
0
 internal static CustomErrorsSection GetSettings(HttpContext context, bool canThrow)
 {
     CustomErrorsSection customErrors = null;
     RuntimeConfig lKGConfig = null;
     if (canThrow)
     {
         lKGConfig = RuntimeConfig.GetConfig(context);
         if (lKGConfig != null)
         {
             customErrors = lKGConfig.CustomErrors;
         }
         return customErrors;
     }
     lKGConfig = RuntimeConfig.GetLKGConfig(context);
     if (lKGConfig != null)
     {
         customErrors = lKGConfig.CustomErrors;
     }
     if (customErrors != null)
     {
         return customErrors;
     }
     if (_default == null)
     {
         _default = new CustomErrorsSection();
     }
     return _default;
 }
コード例 #3
0
        internal static bool CheckAndReadConnectionString(ref string connectionString, bool throwIfError)
        {
            ConnectionStringSettings settings = RuntimeConfig.GetConfig().ConnectionStrings.ConnectionStrings[connectionString];

            if (((settings != null) && (settings.ConnectionString != null)) && (settings.ConnectionString.Length > 0))
            {
                connectionString = settings.ConnectionString;
            }
            return(CheckAndReadRegistryValue(ref connectionString, throwIfError));
        }
コード例 #4
0
        internal static bool CheckAndReadConnectionString(ref string connectionString, bool throwIfError)
        {
            ConnectionStringSettings connObj = RuntimeConfig.GetConfig().ConnectionStrings.ConnectionStrings[connectionString];

            if (connObj != null && connObj.ConnectionString != null && connObj.ConnectionString.Length > 0)
            {
                connectionString = connObj.ConnectionString;
            }

            return(CheckAndReadRegistryValue(ref connectionString, throwIfError));
        }
コード例 #5
0
        internal static string GetUserAgentFromClientTarget(VirtualPath configPath, string clientTarget)
        {
            ClientTargetSection section = RuntimeConfig.GetConfig(configPath).ClientTarget;
            string userAgent            = null;

            if (section.ClientTargets[clientTarget] != null)
            {
                userAgent = section.ClientTargets[clientTarget].UserAgent;
            }
            if (userAgent == null)
            {
                throw new HttpException(System.Web.SR.GetString("Invalid_client_target", new object[] { clientTarget }));
            }
            return(userAgent);
        }
コード例 #6
0
        internal static string GetUserAgentFromClientTarget(VirtualPath configPath, string clientTarget)
        {
            // Lookup ClientTarget section in config.
            ClientTargetSection clientTargetConfig = RuntimeConfig.GetConfig(configPath).ClientTarget;

            string userAgent = null;

            if (clientTargetConfig.ClientTargets[clientTarget] != null)
            {
                userAgent = clientTargetConfig.ClientTargets[clientTarget].UserAgent;
            }

            if (userAgent == null)
            {
                throw new HttpException(SR.GetString(SR.Invalid_client_target, clientTarget));
            }

            return(userAgent);
        }