Exemplo n.º 1
0
    protected override Task ExecuteAsync(
        HttpContext httpContext,
        string path,
        string contentType,
        DateTimeOffset?lastModified    = null,
        EntityTagHeaderValue entityTag = null,
        bool enableRangeProcessing     = false)
    {
        var fileResult = new PhysicalFileResult(path, contentType)
        {
            LastModified          = lastModified,
            EntityTag             = entityTag,
            EnableRangeProcessing = enableRangeProcessing,
        };

        httpContext.RequestServices = CreateServices();
        var actionContext = new ActionContext(httpContext, new(), new());

        return(fileResult.ExecuteResultAsync(actionContext));
    }