1

This is my first question so I apologize if I my post has any mistakes. I've searched about this issue for close to two days now and I still only am a bit closer than I was before.Here is my problem.

We have a website developed using .net 4.5 that accepts file uploads in csv. Recently the client wanted to migrate to cloud, so I put it in a windows server 2008R2 (ec2 instance of aws) and boom the file upload keeps throwing exception. I thought that I had missed some file and transferred the files again yet I had the same problem.

I downloaded visual studio express and brought the source code to debug it (debug uses ASP.net webserver). I found that the content type of csv is being read as text/plain instead of text/csv or application/csv or application/vnd.ms-excel. I was confused as the same code read the content type as application/vnd.ms-excel in the server from which I am migrating.

After a day's worth of search and trying to change MIME type in IIS I got the upload to detect the right type by changing the content type mapping in Registry. My happiness lasted exactly one minute because the same change was not reflected in the site hosted in IIS. I have tried changing in various keys of Registry, IIS and web.config. No go......

I am beyond desperate and close to despondent any help is appreciated, TIA.

  • The MIME type you are setting in IIS are purely for serving files to a browser/downloading files from the server. You are saying your users are uploading *.csv files to the server and that throws an error. What is that error. Normally your code that handles that upload doesn't care about MIME types. Without knowing the error and how the uploaded file is processed, we can't help you. – Peter Hahndorf Aug 21 '15 at 14:26
  • Hey, thanks for helping me out and sorry for not being clearer, its throwing an exception that's coded in, if the content type doesn't match the list given(text/CSV,application/csv,application/vnd.ms-excel, etc), the content type is being read as text/plain instead of application/vnd.ms-excel which is the content type I'm uploading. The same file and the same code runs perfectly fine on the original server. TIA – Prasanth Aug 21 '15 at 17:02
  • @prasanth, welcome to Serverfault! I edited the formatting of your question to make it easier to read. In the future put an empty line between each paragraph so they'll be processed as separate paragraphs, rather than being lumped together. Makes things much nicer. :) – Gene Aug 21 '15 at 18:03
  • @Gene Thanks for the tip and formatting, I'll keep it in mind. – Prasanth Aug 22 '15 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.