Long story short, we have a document library that has two fields that we use to identify files. Our file names are built through SPList objects as well as what a user provides. Since users can choose the same filename (and would be differentiated by our column "metadata") we rename them with GUIDs when we store them into the library.
When users want to retrieve the files however, we are having HUGE issues renaming the files back to the user (using the SharePoint column values and not using the GUID as the filename). We've taken the OOB Download.aspx page but found that it isn't as easy as:
this.Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + SPHttpUtility.UrlEncodeFilenameForHttpHeader("My new File Name.docx") + "\"");
We run into issues stating that the file's contents are corrupted which is strange considering we're only renaming the Filename in the header. Can anyone shine some light onto this issue?
Edit: I'm in a rush at the end of the day here, please let me know if you want more code samples. We aren't overwriting SharePoint's Download.aspx file, we just used a reflector to grab the code and make our own page.