Download Progress Title Bar

  • Thread starter Thread starter Jerry Camel
  • Start date Start date
J

Jerry Camel

When a user is downloading a file from my web page, the title bar has "x% of
MyWebPage.aspx" rather than the name of the file being downloaded. Is there
a way to make the title bar match the file being downloaded? Thanks.

Jerry
 
Sounds as if you are doing some custom streaming of that file to the client.
If you are, spill the code and we'll have a look see.
 
Hi Jerry,

If you are encoding your query then you will get something that is URL
Encoded. Have you tried to use the HttpUtility.UrlDecode()?

Yama
 
Here's the code for the download. It's the progress bar window that IE opens that I'd like to change the title of...

Dim fStream As FileStream
Dim bytesToGo As Long
Dim bytesRead As Long
Dim byteBuffer(2048) As Byte

fStream = New FileStream(rootPath & "\" & e.CommandArgument(), FileMode.Open, FileAccess.Read, FileShare.Read)
bytesToGo = fStream.Length

Response.BufferOutput = False
Response.Clear()
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment; filename=""" & dr("FileName") & """")
Response.AppendHeader("Content-Length", fStream.Length)
Response.Flush()

While (bytesToGo > 0)
If (Response.IsClientConnected) Then
bytesRead = fStream.Read(byteBuffer, 0, 2048)
Response.OutputStream.Write(byteBuffer, 0, bytesRead)
Response.Flush()
bytesToGo -= bytesRead
Else
bytesToGo = -1
End If
End While

fStream.Close()
 
Jerry,

Try to set the following header

Response.AddHeader("Content-Disposition", "attachment;
filename=\"NameOfYourFile.Extension\"");

Hope this helps

Christophe
 
Already got that. It populates the Save dialog without a problem, but still
shows the .aspx name in the progress window. Any other thoughts?

Jerry
 
That doesn't really address the issue. IE automatically pops up a progress
bar when the file is downloading. I just want it to show the proper file
name.
 
Back
Top