How to trigger a download of a file

Posted on 2003-04-01
Medium Priority
Last Modified: 2013-12-25
I have a ISAPI program which retrieves data from a database and writes the data into a file with Comma Separated Value format. When the user triggers the execution of this ISAPI Dll, I want the user to get the file download dialog. What do I need to send instead of the existing code:

      StrPCopy(vBuffer, 'Content-Type: text/html' + CrLf +  CrLf +
                   '<HTML>' + CrLf + '<HEAD>' + CrLF + '<TITLE>Report</TITLE>' + CrLf +
                   '</HEAD>' + CrLf + '<BODY BGCOLOR="#FFFFFF" TEXT="#000000" BACKGROUND="yellowbk.gif"><DIV ALIGN="CENTER"><CENTER>' + CrLf + CrLf );

I suspect I need to change the Content-Type, etc...

Thank you
Question by:moonrise
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
LVL 48

Accepted Solution

Tintin earned 750 total points
ID: 8250208
Content-Type: application/vnd.ms-excel


Content-Type: application/octet-stream

Author Comment

ID: 8250891
Content-Type: application/octet-stream  works - how do I specify the default file name to be used, let say report.csv?
LVL 48

Expert Comment

ID: 8251002
Content-Type: application/octet-stream; name=report.csv

Author Comment

ID: 8265828
instead of using the file name I specify it uses the name of the DLL (ISAPI) - report.dll, any idea why?
LVL 48

Expert Comment

ID: 8266244
Hmmm.  Got me stumped there.

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
The viewer will learn how to count occurrences of each item in an array.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question