Questions tagged [filestreamresult]

57 questions
2
votes
1 answer

FileStreamResult Error Handling

ASP.Net MVC 3 I have an Action that returns a FileStreamResult after it imports a PDF document and stamps it with a watermark. Since it is possible to have a file not found error, how do I return a view instead of a filestream? To complicate things…
Pete
  • 2,393
  • 2
  • 24
  • 31
2
votes
1 answer

How do I convert a FileContentResult to a FileStreamResult?

I have a FileContentResult obtained from a byte array and want to turn it into a FileStreamResult. Is this possible? If so, how?
SantLev
  • 140
  • 3
  • 15
2
votes
0 answers

ASP.Net MVC FileStreamResult to load PDF in HTML Object.Data works in VS 2010 Debug mode and not in IIS

In our application we need to get the PDF from Application and should be displayed on IE9[8 or 7], Application is in ASP.Net MVC 3, the PDF file is coming from SSRS, based on user criteria SSRS will return PDF and that to be shown on browser in …
Hi10
  • 531
  • 1
  • 5
  • 21
1
vote
0 answers

Unit Test a FileStreamResult

I'm working on a ASP.NET Core 2.1 Api controller that returns a FileStreamResult. My business layer returns a MemoryStream object that has been rewound to the start position. What I am trying to do is write a unit test that checks if the expected…
user95488
  • 129
  • 2
  • 11
1
vote
2 answers

Export object to .xlsx to client machine asp.net core

I am current working on export the object into .xlsx file. This is so close to what i need, Export xlsx in ASP.NET Core , but the problem is - this is export to the local project folder wwwroot, and i want export to client machine. i had tried…
Sam sam
  • 33
  • 8
1
vote
2 answers

ASP.Net MVC FileStreamResult, valid chars for FileDownloadName

I have an action method that returns a FileStreamResult, the download works fine, the problem is that although I set the FileDownloadName property of the result object, some of the files are downloaded with another name (specifically the last part…
willvv
  • 8,439
  • 16
  • 66
  • 101
1
vote
0 answers

how to open ms word document file in browser(inline content-disposition) in MVC4

Im try to open files (inline mode) in browser. It's working fine for notepad and PDF files, but not for MS Office files(MS Word, MS Excel). For Ms office files I always get download screen in browser. Im using following code: public FileStreamResult…
A.R
  • 409
  • 8
  • 21
1
vote
1 answer

HTTPHandler vs ASP.NET MVC FileStreamResult

I am working on an ASP.Net MVC application that requires to read some xml files and transform it to HTML before sending it to the client browser. I was wondering if anybody could suggest what is the best option to send the processed stream back to…
XpertSiji
  • 811
  • 1
  • 6
  • 8
1
vote
0 answers

Preventing user from downloading another file if he has already a download in progress in mvc 4

I want to limit user from downloading the second file if his first file download not finished yet, My approach is to insert a record for downloading file on database with finished attribute equal to false; when download finished I change the…
mesut
  • 2,099
  • 3
  • 23
  • 35
1
vote
1 answer

XML + Write to Relative Path

I have the following folder structure TempProj !-js !-jsp !-WEB-INF !-classes !-lib Inside my lib folder, I have a java file that creates an XML file, I actually need the file to be generated inside the jsp folder. I'm creating using…
Vivek
  • 1,451
  • 8
  • 42
  • 74
1
vote
2 answers

Download instead of display (render) generated XML

In a Controller in my ASP.Net MVC app, I serialize a class, and am trying to offer up the contents for immediate download. So far, I've got my controller returning a FileStreamResult public FileStreamResult Create(MyViewMode vm) { …
Alex
  • 37,502
  • 51
  • 204
  • 332
1
vote
1 answer

Unit testing a FileStreamResult

I have a Controller which returns a FileStreamResult via SharpZipLib (I have tried DotNetZip and there is no difference). using (var buffer = new MemoryStream()) { using (var zipStream = new ZipOutputStream(buffer)) { …
Sklivvz
  • 30,601
  • 24
  • 116
  • 172
0
votes
1 answer

MVC Filestream Multiple Calls

I have a FileStreamResult action that, with iTextSharp, opens a PDF document (CAD drawing), stamps our company information on it and then passes it to a memory stream to be returned. Inside the method I have an audit method that records the…
Pete
  • 2,393
  • 2
  • 24
  • 31
0
votes
0 answers

Read FileStreamResult API response and return it as FileContentResult C# .Net 6

I have an API which gets data from another API. This endpoint returns a "FileStreamResult" as the response. I need to read this response content from the other API and return it as "FileContentResult". How could I achieve this? Endpoint - API…
Hash_Dew
  • 313
  • 1
  • 8
0
votes
1 answer

ASP.NET Core FileStreamResult sometimes fails with Value cannot be null. (Parameter 'buffer')

ASP.NET Core FileStreamResult sometimes fails when writing big blob (~1gb) to response ... Azure.Storage.Blobs.BlobClient blob = container.GetBlobClient(fileName) Stream stream = await blob.OpenReadAsync().ConfigureAwait(false); return File(stream,…
Linas
  • 560
  • 1
  • 5
  • 16