Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
0 votes
1 answer
48 views

Why do I get the error "Cannot access a disposed object" when using a stream

I am trying to read an xlsx file using CloseXlm so I created the below ReadFile method. In order to test it, I've created a test method using MSTest and another method that creates an xlsx file and ...
Luciano Umpierrez's user avatar
1 vote
0 answers
154 views

Forwarding file stream to client in Blazor WebServer in .NET 8

I'm writing a Blazor WebServer application which, at one point, allows the client to download a file. This file is forwarded from another API, which offers it as an application/octet-stream message, ...
Evaristo's user avatar
  • 111
0 votes
1 answer
306 views

Large File Upload Results in Corrupted Files

I am currently working on a file upload feature in my application, and I am encountering an issue where the uploaded file appears to be corrupted. The application is designed to handle large file ...
Saqif Haque's user avatar
0 votes
1 answer
3k views

How can i show a pdf on webbrowser using byte Array. C# [duplicate]

im trying to create a pdf file and im trying to return this file on imsonia or webbrowser, but i dont how to do this. here is my code: string beneficiarioRelatorio = "Test" var stream = new ...
José Eronaldo's user avatar
0 votes
1 answer
574 views

How do I save a return list to table asp.net core

I have a method that reads an excel file which user can upload via the front end - see below: public async Task<List<User>> Upload(IFormFile file) { string webRootPath = ...
Jeff's user avatar
  • 125
-1 votes
1 answer
165 views

ASP.NET download email attachment through the MemoryStream failure

On the server side, I have a file containing an XML serialization of a standard System.Net.Mail.MailMessage which may contain attachments. I designed a form to allow users to download these ...
weirdgyn's user avatar
  • 926
0 votes
0 answers
229 views

My memory stream does not write to the content of the httpResponse a ZIP file

I am trying to write the stream resulting from compressing several files in a ZIP but I can't. The ZIP file does, but when I want to write the resulting stream, the copyto method does nothing and my ...
Aetos2501's user avatar
  • 165
0 votes
1 answer
153 views

ASP.NET File function doesn't works with MemoryStream but if copied to temp file, it does

The following code works: MemoryStream s = TarCreator.CreateTar(toDownload); string path = Path.GetTempFileName(); using (var newFile = System.IO.File.OpenWrite(path)) s.CopyTo(newFile); return ...
trinalbadger587's user avatar
1 vote
2 answers
881 views

How to get data from BlazorInputfile

i use BlazorInputFile on my project but dont know how to transform the stream that i get from the input file(a zipFile) to an ZipArchive to loop in it.... i see the stream is ok but when i try to make ...
Khalid Ab's user avatar
  • 195
1 vote
2 answers
1k views

Export multiple files (with different file types) from database (Byte Array) to single zipped file

I need to export multiple files with varying file types (pdf, xlsx, .docx) stored in a database (Byte Array) and save them as a single zipped file. How should I handle the multiple files? I'm assuming ...
Shane's user avatar
  • 542
0 votes
2 answers
895 views

Sftp upload from memory stream asp.net

I am trying to upload a csv file that is created from a query and upload via sftp. I am trying to avoid creating a file and then reading the file to upload it by keeping the data in memory. Thanks in ...
usernamewasfree's user avatar
1 vote
1 answer
577 views

Fail to open merged pdf created with ITextSharp

I'm trying to merge some PDFs and save it to a blob storage in azure, the file is saving in azure I can see the Kbs there and download the file, but when I try to open it I get the "Failed to load PDF ...
Guilherme Flores's user avatar
0 votes
0 answers
207 views

Creating a ZIP Archive in Memory in C#

I'm trying to create a ZIP archive with multiple pdf files as follows: Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("content-disposition", "attachment;...
Rachel Sanchez's user avatar
0 votes
0 answers
995 views

EPPlus:Cannot access a closed Stream when copy existing excel worksheet

I'm currently using EPPlus and right now I'm trying to copy existing worksheet from an excel file and add the copied worksheet to another excel file. But then, Ive encounter this error: Full Stack ...
fatin amirah's user avatar
1 vote
1 answer
653 views

c# - base64 jpeg to MemoryStream?

I have a base64 jpeg like so: data:image/jpeg;base64 and I am trying to convert it to a MemoryStream so I can upload it to OneDrive....Here is what I got so far: byte[] frontBytes = Convert....
user979331's user avatar
  • 11.8k
0 votes
0 answers
172 views

How to solve 'Could not find a part of the path..' issue on server

I'm using Zxing library to create a barcode and memory stream to save it to the server folder. Everything works fine on local as well as a testing server, but when I publish code on client-server it ...
Dark S's user avatar
  • 318
0 votes
1 answer
183 views

Loading base64 string image to DocuVieware

Image files are saved in base64 string format in the database. I'm trying to load the image using DocuVieware via MemoryStream but failed. Does anyone tried this kind of approach? if (this....
sirch sarso's user avatar
-1 votes
1 answer
2k views

Update IformFile

I have a requirement to read an excel file from the system and to modify that file (eg remove duplicates ) and drop it in to another location. I am using IFormFile. Can anyone help me to remove ...
jubi's user avatar
  • 625
0 votes
2 answers
2k views

Is there a way to rename the uploaded file without saving it?

I tried looking into other solutions, however they suggest either: to save the file with a different name with saveAs() to change the file name once the file is saved with Move() or Copy() In my ...
Liudvikas Taluntis's user avatar
0 votes
0 answers
450 views

MemoryStream(Xls) to PDF

I'm using the library FlexCel and need to convert a MemoryStream (Xls Type) to PDF. I tried this form but not work. oFlexCelReport.Run(oTemplateMemoryStream, oOutMemoryStream); oOutMemoryStream.Seek(...
Ronivaldo Roner's user avatar
0 votes
0 answers
551 views

Replacing a String in byte[] pdf file using c#

I'm downloading a pdf file from FTP server. I need to find a string and replace it, but when I try to convert the byte[] to string. It returns a non sense string. WebClient client = new WebClient(); ...
Code Guy's user avatar
  • 105
2 votes
1 answer
3k views

Streaming a blob from Azure storage - Cannot access a closed Stream

I am using asp.net webforms. I have pdfs in Azure storage that I need to process. I am using PDFJet library in order to do that. I would like to stream the pdf without downloading it as I have to ...
Anne's user avatar
  • 101
0 votes
0 answers
356 views

SmtpClient - Attachments occasionally 0 bytes

I have a C# application that uses SmtpClient to send emails. Emails all appear to be being delivered fine however when sending emails with attachments, periodically the attachment will be 0 bytes. I'...
Adam's user avatar
  • 2,682
1 vote
1 answer
707 views

A generic error occurred in GDI+ when resizing image in MemoryStream

I am using ImageProcessor to process images in my website. I have this resize function: public Image ResizePhoto6version(Image img, int width, int height) { using (var ms = new ...
Liron Harel's user avatar
  • 11.2k
-1 votes
2 answers
253 views

Returning a "Using" var

I need to return a MemoryStream, and currently I do it like this: String ICallbackEventHandler.GetCallbackResult() { using (var stream = new MemoryStream()) { this._synth.Rate = this....
tmighty's user avatar
  • 11.3k
2 votes
0 answers
122 views

System.OutOfMemoryException when i m uploading more than 20MB Images

I am Uploading Image more than 20 MB, 2 or 3 times that image uploaded properly, but after performing more than 5-6 uploads it gives an error, and after that it works proper for less than 1MB images ...
JIgsB's user avatar
  • 143
0 votes
0 answers
43 views

ASP.NET: Unable to cast IO.StreamWriter to IO.MemoryStream

I have a complex class module that make a lot of processing and return a object of type IO.StreamWriter, but I need cast this object to IO.MemoryStream, furthemore to Byte(). Finally it converts Byte()...
Vilmar Oliveira's user avatar
1 vote
0 answers
647 views

How to create multiple Excel files from data table and download them as a zip in asp.net using dotnet zip

I am writing a program through which I have to download a zip file which contains multiple Excel files, like a.xls, b.xls etc. I am using FOR loop to get data in datatable. Now I wanted to export ...
Manish Kumar's user avatar
0 votes
0 answers
145 views

Memory stream namespace and classes can be used in a web app c#

I'm trying to play a local encrypted video from a Web App build in C#. I'm running a local server in IIS and for getting the video I make a request to this local server. I've searched on Google an ...
Mustafa aga's user avatar
0 votes
1 answer
37 views

Name of blob after uploading from memorystream

I want to upload a dynamically created excel file to blob. The file is in the form of a byte array. This is what im doing. bytes = package.GetAsByteArray(); CloudStorageAccount storageAccount = ...
Sujit.Warrier's user avatar
0 votes
0 answers
79 views

Why can't I download 2 different files from same page ?

I am using these 2 functions to download 2 different files from a single page. RenderReport is used to download an rdlc report been sent to it i.e. LocalReport and the DOWNLOAD() is used to download ...
Covert's user avatar
  • 491
0 votes
2 answers
1k views

Can't copy PDF File from MemoryStream to FileStream

Am i doing anything wrong? May i ask why can't i open both pdfs file saved? As for MemoryStream it is saved to my directory -> Downloads Folder from Chrome and for FileStream it is saved to the ...
domster's user avatar
  • 566
3 votes
1 answer
14k views

how to get all the data to CSV from memorystream?

Below is my method to export data to CSV. public MemoryStream ExportToCsv(string jsonData, HttpResponseBase response, string fileName) { using (MemoryStream stream = new MemoryStream()) { ...
Kgn-web's user avatar
  • 7,495
0 votes
1 answer
279 views

Create modifiable mail item from memorystream (oft file)

I have oft files stored in the database as binaries. Now I have to open the files so the user only has to click on send. But before this, I have to modify some attributes (To, message). So how can I ...
M.Zuberbühler's user avatar
3 votes
1 answer
4k views

Getting a corrupted XLSX file when writing it to Response.OutputStream

In ASP.Net, I'm using NPOI to write save to an Excel doc and I've just moved to version 2+. It worked fine writing to xls but switching to xlsx is a little more challenging. My new and improved code ...
Andy In NC's user avatar
-1 votes
1 answer
2k views

How to increase the capacity in Memory Stream?

I am using MemoryStream to store a report. But the MemoryStream won't store the report if the size of the report is more than 70000. So I should increase the size of the MemoryStream in that case. ...
Anon_y_20_raj's user avatar
0 votes
0 answers
30 views

PDF doesn't Download itextsharp [duplicate]

This is my code, don't have any error but page doesn't does nothing. I don't know where is the error, please help :O Dim documentoPDF As New Document(PageSize.A4, 10, 10, 10, 10) Dim ...
Leonardo Peyretti's user avatar
-1 votes
1 answer
318 views

ASP MVC return file to browser by reading from sftp

i am able to get the file stream from sftp but unable to render that in browser(chrome) ui from controller. If i store the file in disk and then return its working fine but i want to do that by ...
K Ashok Kumar's user avatar
4 votes
1 answer
574 views

Editing & saving .docx in ASP.NET program using OpenXML & MemoryStream

I'm writing a project which allows you to edit .docx documents (I have a template that needs to be edited) directly from the site and save them to your computer. I have a problem with saving all ...
boyd174's user avatar
  • 41
0 votes
1 answer
5k views

Excel export (xlsx) error Exception of type 'System.OutOfMemoryException' was thrown

I am facing System.OutOfMemoryException while exporting .xlsx file from ASP .Net this is happening while writing the data into memory stream. protected void ExportExcel(string strWorkbookName, ...
Yogi Bear's user avatar
2 votes
1 answer
4k views

how to pick path with MemoryStream

I have the following code: using (Stream responseStream = reply.GetResponseStream()) { //Do not close the stream, this creates an error when saving a JPEG file MemoryStream memoryStream = new ...
jacky brown's user avatar
0 votes
0 answers
142 views

Convert Base64 from PDF to Bitmap [duplicate]

I would like to convert a PDF to a Bitmap, so I can show it on my ASP.NET page. But when I run my code it fails at creating the Bitmap. Does anyone know what's the problem? string filepath = "C:\\...
sarah's user avatar
  • 9
1 vote
0 answers
3k views

How to make a PDF on memory and send it to browser

I want to make a PDF from a HTML string on memory and send it to a browser. I don't want to save a file on the server so I'm using the following code. I'm also using ITextSharp. string thistopdf = "&...
Franco Fittipaldi's user avatar
0 votes
1 answer
160 views

In order to create an access mdb file to download do you have to have a phsyical location for the db?

I would like to create an mdb access file and populate it all in memory and spit it back out to the UI for users to download locally, but I can't see anyway around first having to specify a physical ...
LaRae White's user avatar
  • 1,272
3 votes
1 answer
4k views

Stream.Read always returning 0

We are using Asyncfileupload control of asp.net to upload the file, the same is not working we have debugged and found this code: input.Read(buffer, 0, buffer.Length) returning 0. The entire code ...
Yogesh Aswani's user avatar
2 votes
2 answers
6k views

Sending image with byte array convertion, from java to c#

I am trying to send a .jpg file which is on my android device to my server computer. To do this, I am converting the picture into a byte array by a java android application, and sending it as an ...
0014's user avatar
  • 923
0 votes
2 answers
3k views

FileStream action writing empty file

I have an ASP.Net MVC 4 app that is downloading an empty file. What am I missing? Controller: public class HomeController : Controller { public ActionResult Index() { return View(); ...
drewwyatt's user avatar
  • 6,027
0 votes
1 answer
2k views

It's possible to temporary store file in ASP.NET ViewState as byte[]?

I've seen this: How can I store a byte[] list in viewstate? and I'm trying to do the same with byte[] from a FileUpload: <asp:FileUpload ID="Documento" runat="server" /> <asp:ImageButton ...
MisterFrank's user avatar
0 votes
0 answers
462 views

Retrieving thumbnailPhoto in C#

Grabbing a thumbnailPhoto from active directory. Would this be the correct way of encoding it to byte array. Because when I try to convert this byte array to an image, I get parameter not valid error. ...
1011 1110's user avatar
  • 771
0 votes
1 answer
268 views

itextsharp pdfsmartcopy only returning last page

I have an issue where only the last page of my pdf is stored. The pdf should be multiple pages long, and this works fine if I just send the pdf to the browser using Response and the mms memory stream,...
dave's user avatar
  • 1,430