title: System.Web.HttpContext.Current.Response parses a field
body: <p>This is a weird one...  I have a CSV file on the server and make it available to users via the code below. Typically, the results set is correct, except that it always omits the last field of the last record:</p>
  
  <p>Co Name,Process Date,Employee Id,Last Name,First Name,Cust Auth,ENTERED_HRS,Labor Type</p>
  
  <p>Temp,2014-02-21,CONTRACTOR0001,Dahlenburg,Eric,131137057134,5,0</p>
  
  <p>Temp,2014-02-21,CONTRACTOR0001,Dahlenburg,Eric,1411310002,8,0</p>
  
  <p>Temp,2014-02-21,CONTRACTOR0001,Dahlenburg,Eric,1411320015,6.69,0</p>
  
  <p>Temp,2014-02-21,CONTRACTOR0001,Dahlenburg,Eric,1413500001105,6</p>
  
  <p>Notice there is no ",0" at the end of the last record?  In Visual Studios, it works fine, but on my development server, it omits that last part.  </p>
  
  <p>I verified that the source CSV file has all the data fields. I tried different path locations for the CSV file, but no change. Can't understand why it works on Visual Studios and not on the server. </p>
  
  <p>addendum: I don't know if it matters, but the source file is located on a virtual directory(not physical) on the server. Any Ideas???</p>
  
  <pre><code>           // Causes Save As Dialog box to appear for user.
              String FileName = fileName;
              String FilePath = strFilePath;
  
              System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
              response.ClearContent();
              response.Clear();
              response.ContentType = "text/csv";
              response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
              response.WriteFile(FilePath + FileName);
              response.Flush();
              response.Close();
              //   response.End();  // Same as response.TransmitFile(), but causes an exception because it raises the EndRequest event.
  </code></pre>