/// <summary> /// Sends file to the client /// </summary> public IActionResult ToClient() { //log what file is attempting to be downloaded if (string.IsNullOrWhiteSpace(ETag)) { Logger.LogInformation($"Downloading {FileName}."); } else { Logger.LogInformation($"Downloading {FileName} with an etag value of {ETag}."); } //validate requrired properties if (string.IsNullOrWhiteSpace(FileName)) { throw new ArgumentException("Invalid file name"); } if (Contents == null || Contents.Length == 0) { throw new ArgumentException("File contents null or empty"); } //create IActionResult FileContentResult file = new FileContentResult(Contents, ContentType); file.FileDownloadName = FileName; if (DateModified != null) { file.LastModified = DateModified; } if (!string.IsNullOrWhiteSpace(ETag)) { Microsoft.Net.Http.Headers.EntityTagHeaderValue etag = new Microsoft.Net.Http.Headers.EntityTagHeaderValue(ETag); file.EntityTag = etag; } return(file); }
public static System.Net.Http.Headers.EntityTagHeaderValue ToSystemETag(this Microsoft.Net.Http.Headers.EntityTagHeaderValue value) { return(value.Tag.Value.StartsWith("\"") && value.Tag.Value.EndsWith("\"") ? new System.Net.Http.Headers.EntityTagHeaderValue(value.Tag.Value, value.IsWeak) : new System.Net.Http.Headers.EntityTagHeaderValue($"\"{value.Tag}\"", value.IsWeak)); }
public static bool TryParse(Microsoft.Extensions.Primitives.StringSegment input, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out Microsoft.Net.Http.Headers.EntityTagHeaderValue parsedValue) { throw null; }
public RangeConditionHeaderValue(Microsoft.Net.Http.Headers.EntityTagHeaderValue entityTag) { }
public static bool TryParse(Microsoft.Extensions.Primitives.StringSegment input, out Microsoft.Net.Http.Headers.EntityTagHeaderValue parsedValue) { throw null; }
public bool Compare(Microsoft.Net.Http.Headers.EntityTagHeaderValue other, bool useStrongComparison) { throw null; }
public static bool TryParse(string input, out Microsoft.Net.Http.Headers.EntityTagHeaderValue parsedValue) { parsedValue = default(Microsoft.Net.Http.Headers.EntityTagHeaderValue); throw null; }