Esempio n. 1
0
        public static void RemoveRewriteRule(string ruleName)
        {
            HttpModuleCollection modules = System.Web.HttpContext.Current.ApplicationInstance.Modules;

            foreach (string moduleName in modules)
            {
                UrlRewriteModule rewriteModule = modules[moduleName] as UrlRewriteModule;
                if (rewriteModule != null)
                {
                    rewriteModule.RemoveRewriteRuleInternal(ruleName);
                }
            }
        }
Esempio n. 2
0
        public static void InsertRewriteRule(string positionRuleName, string ruleName, RewriteRule rewriteRule)
        {
            if (rewriteRule == null)
            {
                throw new ArgumentNullException("rewriteRule");
            }
            rewriteRule.Name = ruleName;
            HttpModuleCollection modules = System.Web.HttpContext.Current.ApplicationInstance.Modules;

            foreach (string moduleName in modules)
            {
                UrlRewriteModule rewriteModule = modules[moduleName] as UrlRewriteModule;
                if (rewriteModule != null)
                {
                    rewriteModule.InsertRewriteRuleBeforeInternal(positionRuleName, ruleName, rewriteRule);
                }
            }
        }
Esempio n. 3
0
        public static void AddRewriteRule(string ruleName, RewriteRule rewriteRule)
        {
            if (rewriteRule == null)
            {
                throw new ArgumentNullException("rewriteRule");
            }
            rewriteRule.Name = ruleName;
            HttpModuleCollection modules = HttpContext.Current.ApplicationInstance.Modules;

            foreach (string moduleName in modules)
            {
                UrlRewriteModule rewriteModule = modules[moduleName] as UrlRewriteModule;
                if (rewriteModule != null)
                {
                    rewriteModule.AddRewriteRuleInternal(rewriteRule);
                }
            }
        }