Solved

HttpPostFile.SaveAs is saving empty file in IIS

Posted on 2012-04-03
2
529 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Maps with Webforms 1 29
ASP.NET Built-In Report Creator / Viewer 5 25
CSS for Popup in ASP.NET 4 18
asp.net repeater 2 13
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 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