Exemplo n.º 1
0
 private static FileStreamResult CreateFileResult(IFile file, MediaPathData pathData)
 {
     return(new FileStreamResult(file.OpenRead(), pathData.MimeType)
     {
         EnableRangeProcessing = true,
         // INFO: (core)(perf)I think ETag is sufficient and ignoring this reduces header comparison by one item.
         //LastModified = file.LastModified,
         EntityTag = new EntityTagHeaderValue('\"' + ETagUtility.GenerateETag(file) + '\"')
     });
 }
        private static bool TryBuildEntityTagHeader(IPreconditionInformation preconditionInformation, out EntityTagHeaderValue headerValue)
        {
            string eTag;

            if (ETagUtility.TryCreate(preconditionInformation, out eTag))
            {
                headerValue = new EntityTagHeaderValue(ETagUtility.FormatStandard(eTag));

                return(true);
            }
            else
            {
                headerValue = null;

                return(false);
            }
        }