473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Dowload with "thanks"

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
Feb 4 '07 #1
3 1250
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.

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"Ken Ross" <belthenaar_at_comcast_dot_netwrote in message
news:Xn**********************************@207.46.2 48.16...
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

Feb 4 '07 #2
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
-----------------------------------------
Feb 4 '07 #3
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

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Ken Ross" wrote:
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
Feb 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Furey | last post by:
Hi I have an XML documnet and a XSLT document as shown below THe XSLT document brings back a filtered docmument that has the VendorName that starts with a particular sub-string This works as...
7
by: Richard | last post by:
How do I prevent a submit action from occurring if the select box has no value. The box is for a database search where the user must enter a keyword. Leaving the box empty triggers a blanket...
8
by: Don Miller | last post by:
I've been extensively modifying a web application (ASP, COM+) to take advantage of the XMLHTTP object for asynchronous requests (e.g. Ajax) on my dev machine (Win2KPro). I test the application from...
3
by: NecroJoe | last post by:
I am using PHP to generate a little javascript for one of my pages. In short it allows a user to select a value from a list and pop it into a form field on a seperate page. This works well unless...
3
by: AJ | last post by:
Hi , I am trying to dynamically change file name of an html that is generated through a cgi script, I know that for it is easy to do this for other type of files such as pdf or csv which we...
0
by: Joeyej | last post by:
Hi - I'm trying to move/use a web form (containing some javascript field checks) previously hosted on a Windows 2000 server. However, the FORM METHOD="post..." command in the form (shown below)...
4
by: davidw | last post by:
For example, I have a virtual directory - "wfile", I would like user access http://mysite/wfile, but I want to handle it with my own code instead of turn on "Directory Browsing", how can I capture...
7
by: RFS666 | last post by:
Hello, I would like to use variables with a type in jscript.NET. I declare them as follows: var x : double = 5.03; This doesn't work in my script, that I write to the page in codebehind with...
4
by: fran7 | last post by:
Hi, from help in the javascript forum I found the error in some code but need help. This bit of code works perfectly, trouble is I am writing it to a javascript function so the height needs to be in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.