Horje
c# webapi return file Code Example
c# webapi return file
[HttpGet]
public HttpResponseMessage Generate()
{
    var stream = new MemoryStream();
    // processing the stream.

    var result = new HttpResponseMessage(HttpStatusCode.OK)
    {
        Content = new ByteArrayContent(stream.ToArray())
    };
    result.Content.Headers.ContentDisposition =
        new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment")
    {
        FileName = "CertificationCard.pdf"
    };
    result.Content.Headers.ContentType =
        new MediaTypeHeaderValue("application/octet-stream");

    return result;
}




Csharp

Related
take out substring from string Code Example take out substring from string Code Example
unity stopwatch timer Code Example unity stopwatch timer Code Example
How Many Vowels Code Example How Many Vowels Code Example
Area Of the triangle with condition Code Example Area Of the triangle with condition Code Example
c# generate random date of birth but over 18 Code Example c# generate random date of birth but over 18 Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13