Hi All,
I have an asp.net 1.1 application that includes a rudimentary contacts database that must support importing from and exporting to Outlook. The file upload part works fine, but I'm having trouble allowing users to download their contacts so that they can import into Outlook.
I am using a csv file to exchange the data been our system and Outlook. For security reasons I have avoided writing user's contacts to a csv file on the server and then providing a link to it, and have instead tried to create the required output and stream it directly to their browser.
The code that creates the csv file is contained in a class that implements the IHttpHandler interface. It sets the following headers:
Context.Response.ContentType = "text/comma-separated-values"
Context.Response.AppendHeader("Content-Disposition", "attachment; filename=""Contacts.csv""")
It also queries the database and loops through the records using response.write statements to create the required output.
The application's web.config file has the appropriate <httpHandlers> element, and the application has been configured to handle .csv files with the aspnet_isapi.dll ISAPI extension.
This setup works exactly the way I want it to on the development server: The application redirects the user to a file called Contacts.csv and they are prompted to save the file to their hard drive with the name Contacts.csv. The file is then downloaded successfully.
On our production server the user is prompted to save the file. However after clicking the save button the users receive the following error:
Internet Explorer cannot download Contacts.csv from ServerName.
Internet Explorer was not able to open this Internet Site. The requested site is either unavailable or cannot be found. Please try again later.
Any ideas about what could be causing the error?
Regards,
Guy Penfold