Dowload with "thanks"

K

Ken Ross

Hi all,

I have an asp.net 2.0 page that allows users to download a file after
clicking the "download now" button. I'm using very similar code to what
I've seen on a number of other posts:

Response.Clear()
Response.ContentType = "application/octet-stream"
Response.TransmitFile(fullFilePath)
Response.End()

What I'd really like to have happen is that after the user clicks the
button and the file download completes, have the page refresh with some
sort of "thank you" message.

I've wasted hours [and hours] trying to work out a solution to this but no
love.

Thanks for any help you can give.

Ken
 
M

Mark Fitzpatrick

Ken,
I don't think you'll get it to work like this. You can't append any
sort of thank you to this page. What you'll have to do is find a way to open
the page that downloads this file as a new window. Then in your original
page you can handle the action and display the message. You could, for a
silly idea off the top of my head, have a linkbutton that when it posts back
to the page can reveal a thank you message in a panel, and also possibly
dump some javascript to the browser that will then open a new window with
the output page appearing in the new browser window instance.
 
M

MasterGaurav \(www.edujini-labs.com\)

Ken,
I don't think you'll get it to work like this. You can't append any

I agree with Mark.
Anything that you send after the file contents will be considered as the
response to the same request and, hence, the contents of the fil itself.

You may want to do the following:

1. Say, "Thank you"
2. Start the timer after 0-5 seconds for the actual download.

The start of the download may be triggered by:

a. Simple javascript code, location.href =
'DownloadPage.aspx?id=<component-id>"
b. 'Refresh' meta-tag

You may want to probably look at the downloads available at the MSDN,
how the thank-you is said first and download starts thereafter.


HTH


--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com
www.edujini-labs.com
http://eduzine.edujini-labs.com
-----------------------------------------
 
G

Guest

Most sites that offer a download link use the HTTP Meta "Refresh" tag with a
timed redirect to the actual file location. (They also provide a link to it
that says something like "if your download doesn't start within X, click
here" ) They then redirect (after the download) to a "Thank you" page.
You can find numerous examples of this.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top