Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

C# MemoryStream - Timeouts are not supported on this stream

    [System.Web.Http.HttpGet]
    [System.Web.Http.Route("export-to-csv")]
    public FileStreamResult ExportDeposits([FromUri(Name = "")]DepositSearchParamsVM depositSearchParamsVM)
    {
        if (depositSearchParamsVM == null)
        {
            depositSearchParamsVM = new DepositSearchParamsVM();
        }
        var records = _DepositsService.SearchDeposits(depositSearchParamsVM);
        var result = _DepositsService.WriteCsvToMemory(records);
        var memoryStream = new MemoryStream(result);
        Response.ContentType = new MediaTypeHeaderValue("application/octet-stream").ToString();// Content type
        return new FileStreamResult(memoryStream, "text/csv") { FileDownloadName = "export.csv" };
    }
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #MemoryStream #Timeouts #supported #stream
ADD COMMENT
Topic
Name
7+6 =