title: Why the filename header is incomplete if this has space in ASP.NET MVC 3?
body: <p>I met today an issue, it is strange for me but, maybe, not for experts in C# field.</p>
  
  <p>I have a function called <code>Download</code> like this ( a piece of code !)</p>
  
  <pre><code>public void Download (string path){
    HttpContext.Current.Response.ContentType = "application/octet-stream";
  
    try {
             ....//process a 'filePath' variable using the 'path' parameter
  
                 using ( FileStream sourceFile = new FileStream( filePath, FileMode.Open ) ) {
                   ...
  
                    HttpContext.Current.Response.AddHeader( "Content-Disposition", "attachment; filename=" + Path.GetFileName( filePath ) );
  
                    HttpContext.Current.Response.AddHeader( "Content-Length", fileSize.ToString() );
  
                    HttpContext.Current.Response.BinaryWrite( getContent );
                 }
             ...
  
  }
  </code></pre>
  
  <p>If file name mentioned and stored in <code>path</code>/<code>filePath</code> variable contains space like </p>
  
  <p><code>PR SimpleTest.xls</code> </p>
  
  <p>then the download box contains file name like <code>PR</code> with nothing additional.</p>
  
  <p><img src="https://i.stack.imgur.com/gE74j.png" alt="enter image description here"></p>
  
  <p>If that file name has <strong>NO</strong> space (like <code>PR_SimpleTest.xls</code>) then the header comes with <code>PR_SimpleTest.xls</code> and I can download as such (appears full filename with his extension).</p>
  
  <p>There are solution(s) to solve issue in case when file name contains space(s) ?</p>