public override async Task Invoke(IOwinContext context)
        {
            Uri url = context.Request.Uri;

            RedirectRule rule = GetRedirectRuleForUrl(url.AbsoluteUri);

            if (rule == null)
            {
                await Next.Invoke(context);
            }
            else
            {
                context.Response.StatusCode = 301;
                context.Response.Headers.Set("Location", rule.Destination);
            }
        }
        private RedirectRule GetRedirectRuleForUrl(string absoluteUri)
        {
            RedirectRule rule = _options.RedirectRules.FirstOrDefault(r => String.Equals(r.Source, absoluteUri, StringComparison.InvariantCultureIgnoreCase));

            return(rule);
        }