File download problem: filename with spaces truncated!

asp.net, c#-4.0

Solution

I found the solution :)

We have to surround the filename with double quotation mark like :

Response.AddHeader("Content-Disposition", "attachment; filename=\"" + Path.GetFileName(_Filename) + "\"");

But up till now, I didn't have any idea for this split?

Problem

While I am working on code to download file from server using : ``` Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlPathEncode(Path.GetFileName(_Filename))); ``` The problem is while having spaces in the file name, with this code the server split automatically while finding the first space! I'm hoping to know Why & what is the solution for that?

Original source