コード例 #1
0
        private Task TryServeStaticFile(HttpContext context, string?contentType, PathString subPath)
        {
            var fileContext = new StaticFileContext(context, _options, _logger, _fileProvider, contentType, subPath);

            if (!fileContext.LookupFileInfo())
            {
                _logger.FileNotFound(fileContext.SubPath);
            }
            else
            {
                // If we get here, we can try to serve the file
                return(fileContext.ServeStaticFile(context, _next));
            }

            return(_next(context));
        }