Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

[RESOLVED] File download

$
0
0
I have used the following code for several years and never had an issue down loading .docx file from our web site to the user.

Code:

                    Dim fi As New IO.FileInfo(FileName)
                    'Resp is a HttpResponse from DwnLD.aspx.vb
                    Resp.Clear()
                    Resp.ClearHeaders()
                    Resp.ClearContent()
                    Resp.AppendHeader("Content-Disposition", "attachment; filename=" & IO.Path.GetFileName(FileName))
                    Resp.AppendHeader("Content-Length", fi.Length.ToString())
                    'hmmm....
                    '                  "application/octet-stream"
                    'for .docx files
                    '                  "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
                    ' Resp.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessing*?ml.document"
                    Resp.ContentType = System.Web.MimeMapping.GetMimeMapping(FileName)
                    Resp.TransmitFile(FileName)
                    Resp.Flush()

We recently updated the server and now users can't download the files. We get a file name and network error in the download files drop down. Don't have the error when running in the development environment.

Windows server version - 24H2
IIS Version - 10.0.26100.1

Any help is appreciated. THX

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>