|HTML code cannot be included in the HTTP Response with a downloaded file without corrupting the file, because the browser cannot parse the body of the Response and distinguish the HTML code from the content of the file. An HTTP download must contain only the response headers and the binary file itself.
To prevent the Response stream from being corrupted by extraneous HTML, you can clear it before calling the TransferFile method, and then end the Response:
Possible causes of extraneous HTML code in the Response are:
- HTML response generated by the download processing page in an attempt to send a message to the user. Instead of inserting HTML code into the download page, the client form could be redirected to another page.
A file download may also be corrupted by server-side debugging messages. To turn off server-side debugging, open the IIS console and right-click on the default website and select Properties. Select the Home Directory tab and then press the Configuration button; select the App Debugging tab and un-check both Debugging Flags.
- If you are using an evaluation copy of FileUp, the downloaded files might be corrupted by the warning message that is automatically presented to users after they upload or download a file. This warning message appears for the last 10 days before the evaluation version expires. NOTE: The warning message cannot be removed using the method described above with Response.clear, because the warning message is generated by FileUp itself when TransferFile is called. If you need to test or demonstrate FileUp's download functionality during the end of a month, please contact SoftArtisans support to obtain a newer evaluation version.