Exemplo n.º 1
0
        public Task RouteAsync(RouteContext context)
        {
            var requestPath = context.HttpContext.Request.Path.Value ?? string.Empty;

            if (requestPath.StartsWith(_prefix, StringComparison.OrdinalIgnoreCase))
            {
                if (requestPath.Length > _prefix.Length)
                {
                    var lastCharacter = requestPath[_prefix.Length];
                    if (lastCharacter != '/' && lastCharacter != '#' && lastCharacter != '?')
                    {
                        return(Task.CompletedTask);
                    }
                }

                context.Handler = _target.GetRequestHandler(context.HttpContext, context.RouteData);
            }

            return(Task.CompletedTask);
        }