Fixed enable and negate flag issue.

This commit is contained in:
Mikael Mengistu 2016-10-24 12:39:42 -07:00 committed by GitHub
parent 88aff41b78
commit 2a153b38fe
1 changed files with 17 additions and 1 deletions

View File

@ -38,6 +38,11 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
return;
}
if (string.Equals(rules.Name.ToString(), "GlobalRules", StringComparison.OrdinalIgnoreCase))
{
throw new NotSupportedException("Support for global rules has not been implemented yet");
}
foreach (var rule in rules.Elements(RewriteTags.Rule))
{
var builder = new UrlRewriteRuleBuilder();
@ -59,6 +64,17 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
{
builder.Enabled = true;
}
else
{
if (enabled)
{
builder.Enabled = enabled;
}
else
{
return;
}
}
PatternSyntax patternSyntax;
if (!Enum.TryParse(rule.Attribute(RewriteTags.PatternSyntax)?.Value, out patternSyntax))
@ -149,7 +165,7 @@ namespace Microsoft.AspNetCore.Rewrite.Internal.IISUrlRewrite
bool negate;
if (!bool.TryParse(condition.Attribute(RewriteTags.Negate)?.Value, out negate))
{
ignoreCase = false;
negate = false;
}
MatchType matchType;