Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5966989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:52:42+00:00 2026-05-22T19:52:42+00:00

The ASP code below grabs the content of a file (thisoutfile – which has

  • 0

The ASP code below grabs the content of a file (thisoutfile – which has a GUID as its file name) and streams it to the browser, providing the suggested filename to save as. This works in all browsers except chrome where the filename offered is the name of the script itself, even when the file name (thisfname) is a single word. If you actually save the file as xls or pdf then it saves it OK.

Any idea why?

Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile(thisoutfile)

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(f.Path)
dataSize = f.size
Response.Buffer = true
Response.CharSet = "UTF-8"
Response.clear
select case ext
    case "xls"
        response.contentType="application/vnd.ms-excel"
    case else
        Response.ContentType = "application/x-unknown" ' arbitrary
end select
Response.AddHeader "Content-Length", dataSize
Response.AddHeader "Content-Disposition","attachment;filename=""" & thisfname & ""

Response.flush
do while not adoStream.eos
    Response.BinaryWrite adoStream.Read(1024 * 8)
    Response.flush
loop
Response.End()
adoStream.close
set adoStream=nothing
set f=nothing
set fs=nothing
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T19:52:43+00:00Added an answer on May 22, 2026 at 7:52 pm

    There is a missing double-quote in the Content-Disposition header and it seems Chrome is not that forgiving. Change that line of code to

    Response.AddHeader "Content-Disposition","attachment;filename=""" & thisfname & """"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a DatePicker user control (ASP code below, no code behind) which is
In my code attached below, I'm trying to upload a file via ASP.NET. I
I use code below to send file from ASP.NET Rest Api to client. Sometimes
I used below code in ASp.NET web forms code behined. Its passing parameter in
I have the javascript code below which disables an asp.net button during page postback.
My ASP.NET application return PDF file to user using code below Context.Response.Clear(); Context.Response.ContentType =
I'm trying to set the port on a cookie in ASP.NET (code below), but
I was given the code below to disable a button on an ASP.Net page
I am using the code below to validate integers and floats in ASP.NET, but
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.