prompting user to download files
Hi,
I have an asp page where i display links to documents on my webserver. If user clicks on the link, I want to prompt him with Open/Download dialog box.
I am using the following code. But only pdfs are getting opened.
My word,excel,ppt, are giving problem.
Is there a way to fix this. I am using following code.
Sub OpenDoc
Dim Stream
Dim Contents
Dim strFileName
Dim strFilePath
strFilePath = "G:\KWindow users in UK.doc"
strFileName = "KWindow users in UK.doc"
'Response.ContentType = "application/x-msexcel"
'Response.ContentType = "application/vnd.ms-excel"
'Response.ContentType = "application/msword"
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" & strFileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Open
Stream.LoadFromFile strFilePath
Contents = Stream.ReadText
Response.BinaryWrite Contents
Stream.Close
Set Stream = Nothing
End Sub
Please do help me,
rgds
|