Ejemplo n.º 1
0
        public async Task Invoke(HttpContext context)
        {
            var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment));

            if (context.GetFeature <IHttpSendFileFeature>() == null)
            {
                var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath);
                context.SetFeature <IHttpSendFileFeature>(sendFile);
            }

            await _next(context);
        }
Ejemplo n.º 2
0
        public async Task Invoke(HttpContext context)
        {
            var environment = (IApplicationEnvironment)context.RequestServices.GetService(typeof(IApplicationEnvironment));

            if (context.Features.Get<IHttpSendFileFeature>() == null)
            {
                var sendFile = new SendFileFallBack(context.Response.Body, environment.ApplicationBasePath);
                context.Features.Set<IHttpSendFileFeature>(sendFile);
            }

            await _next(context);
        }