Sankar,
I have not heard from you and I am leaving for the weekend.
Here is my most detailed instruction demo which I have working on my machine now. If you still have problems....
Speak to you on Monday.
Create the three pages below in your web application as three seperate pages.
Change the
IPADDRESS in download asp to the IPADDRESS of you application and the
FOLDER name / structure to where ever you put the files within your application.
Also save any excel file and call it testExcelFile.xls into the same directory.
Go to theLinkPage.html in your app and test the links.
Once you get this working you can mess with the code to make it suit your files and folders better.
::::CODE FOR PAGE CALLED (download.asp)::::
<% @language ="vbscript" %>
<% response.buffer = true %>
<%
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
'Point this to the file you wish to download
xml.Open "GET","http://IPADDRESS/FOLDER/" & request("FileName"),False
xml.Send
' Add a header to give it a file name:
Response.AddHeader "Content-Disposition", _
"attachment;filename=" & request("DisplayFileName")
' Specify the content type to tell the browser what to do.
'THIS FOOLS THE BROWSER INTO THINKING YOU WISH TO DOWNLOAD A ZIP FILE
Response.ContentType = "application/zip"
' Binarywrite the bytes to the browser
Response.BinaryWrite xml.responseBody
Set xml = Nothing
%>
::::END CODE (download.asp)::::
::::CODE FOR PAGE CALLED (generatedExample.asp)::::
<% @language ="vbscript" %>
<% response.buffer = true %>
<%
'Obviously you can do much more than this with a db connection and stuff.
response.write("CSV FILE WILL OPEN IN EXCEL" & vbNewLine)
response.write("a,b,c,d" & vbNewLine)
response.write("1,2,3,4" & vbNewLine)
%>
::::END CODE (generatedExample.asp)::::
::::CODE FOR PAGE CALLED (theLinkPage.html)::::
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
These are the links you put on your page.
<BR>
<a href="download.asp?DisplayFileName=displayExcelFil eName.xls&FileName=testExcelFile.xls">Download Your Excel File</a>
<BR><BR>
<a href="download.asp?DisplayFileName=displayGenerate dFileName.xls&FileName=generatedExample.asp">Downl oad Your Generated File</a>
</body>
</html>
::::END CODE (theLinkPage.html)::::
The working demo is at
http://192.168.150.100:81/HiSankar/theLinkPage.html
But you can not see the working asp code that way.
'Av a Good Weekend!
Rod
======================================
They say, best men are moulded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================