Solved

HttpPostFile.SaveAs is saving empty file in IIS

Posted on 2012-04-03
2
525 Views
Last Modified: 2012-04-04
I upload multiple files via an ASP page and save them as HttpPostFiles in a datatable while the user enters data in a form. When the user clicks Save, I write the data to SQL tables and save the HttpPostFiles to a server folder.

This works fine in debug mode in Visual Studio 2010, but not in IIS 7 on my local PC. It does work with only one file in IIS.

The symptom when it fails is that the files get saved to the server folder with 0 bytes, and the code does not save the database record. I suspect it fails, but Console.Write does not record anything in the IIS log file.

Its funny that it works with one file, but when it fails with with multiple files, even the first file in the datatable does not get saved properly.
RequestEdit.aspx.cs
Export-Doc.cs
RequestEdit.aspx
0
Comment
Question by:venture-it
2 Comments
 
LVL 21

Accepted Solution

by:
Craig Wagner earned 500 total points
ID: 37806622
The first problem is your debugging technique. Console.Write() isn't going to go anywhere in a web application. Options that you could use would be to use Debug.Write and then use the debug viewer from SysInternals (http://technet.microsoft.com/en-us/sysinternals/bb896647) to watch the debug output. Another option would be to write to the Windows Event Log. Third would be to remove the try/catch temporarily and let the exception turn into a YSOD in the browser. The way save_Docs and save_New_Docs are currently working you are effectively swallowing any exceptions that occur.
0
 

Author Comment

by:venture-it
ID: 37808407
Thanks, I got the Debug.Write to work with the debug viewer. I will accept this as solution so you get the points,  and will repost when I have more analysis.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now