473,388 Members | 1,286 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,388 software developers and data experts.

Automatic download start

I have a piece of software that people can download and a third party
promoting that software. In order for them to be able to count the number
of downloads, I have to put a tracking code on my site. The tracking code
must be sent to the client when the user clicks the download button. At the
same time, the download must start. The download button links to this page:

- Possibility 1, server side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<body>
<some iframe tracking code>
</body>
</html>
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

When I do this, the tracking code is not displayed because the redirect
happens earlier. The download does start though.

- Possibility 2: client side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/myproggie.exe";
}
</script>
<html>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

When I do this, Windows XP SP2 users see a yellow message in the top of
their browser that the site is trying to execute a program. I don't want
that because it scares users away.

- Possibility 3: client side redirect to asp page that performs a server
side redirect
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/startdownload.asp";
}
</script>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

[startdownload.asp]
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

This also gives the warning in XP SP2. The strange thing is when I link the
download button directly to startdownload.asp, there's no warning.

How can I get this to work?
Jun 23 '06 #1
2 2534
you should move the tracking code logic to the server. have an aspx page do
the download:

mydownloadpage.aspx?id=<download file id>&src=<third party site id>

use Response.WriteFile and response headers to do the download. google for
more info.

-- bruce (sqlwork.com)

"Jan Paul van de Berg" <ja**@ulvandebe.rg> wrote in message
news:n4*****************************@40tude.net...
I have a piece of software that people can download and a third party
promoting that software. In order for them to be able to count the number
of downloads, I have to put a tracking code on my site. The tracking code
must be sent to the client when the user clicks the download button. At
the
same time, the download must start. The download button links to this
page:

- Possibility 1, server side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<body>
<some iframe tracking code>
</body>
</html>
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

When I do this, the tracking code is not displayed because the redirect
happens earlier. The download does start though.

- Possibility 2: client side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/myproggie.exe";
}
</script>
<html>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

When I do this, Windows XP SP2 users see a yellow message in the top of
their browser that the site is trying to execute a program. I don't want
that because it scares users away.

- Possibility 3: client side redirect to asp page that performs a server
side redirect
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/startdownload.asp";
}
</script>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

[startdownload.asp]
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

This also gives the warning in XP SP2. The strange thing is when I link
the
download button directly to startdownload.asp, there's no warning.

How can I get this to work?

Jun 23 '06 #2
Thanks for the info. Unfortunately all examples I find assume you don't
have a 3rd party script but just want to force the download start. I've
tried this [1]:

<%@ Import Namespace="System.IO"%>
<script language="VB" runat="server">
Sub Page_Load(sender As Object, e As EventArgs)

Dim filepath As String = Server.MapPath("myproggie.exe")
If File.Exists(filepath) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)
End If

End Sub
</script>

No matter what I try, I can't get mydownloadpage.aspx to send html to the
browser. Not by adding Response.Write(<3rd party script>) anywhere, not by
adding HTML. It behaves like Possibility 1 I described.

[1] a modified version of
http://www.ondotnet.com/pub/a/dotnet...04/01/asp.html, all other
references to this method I can find work the same

Op Fri, 23 Jun 2006 08:56:09 -0700 schreef bruce barker (sqlwork.com):
you should move the tracking code logic to the server. have an aspx page do
the download:

mydownloadpage.aspx?id=<download file id>&src=<third party site id>

use Response.WriteFile and response headers to do the download. google for
more info.

-- bruce (sqlwork.com)

"Jan Paul van de Berg" <ja**@ulvandebe.rg> wrote in message
news:n4*****************************@40tude.net...
I have a piece of software that people can download and a third party
promoting that software. In order for them to be able to count the number
of downloads, I have to put a tracking code on my site. The tracking code
must be sent to the client when the user clicks the download button. At
the
same time, the download must start. The download button links to this
page:

- Possibility 1, server side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<body>
<some iframe tracking code>
</body>
</html>
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

When I do this, the tracking code is not displayed because the redirect
happens earlier. The download does start though.

- Possibility 2: client side redirect to executable
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/myproggie.exe";
}
</script>
<html>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

When I do this, Windows XP SP2 users see a yellow message in the top of
their browser that the site is trying to execute a program. I don't want
that because it scares users away.

- Possibility 3: client side redirect to asp page that performs a server
side redirect
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<script language="javascript">
function startDownload() {
location.href = "http://mysite.bla/startdownload.asp";
}
</script>
<body>
<some iframe tracking code>
<script language="javascript"> startDownload() </script>
</body>
</html>

[startdownload.asp]
<%Response.Redirect("http://mysite.bla/myproggie.exe");%>

This also gives the warning in XP SP2. The strange thing is when I link
the
download button directly to startdownload.asp, there's no warning.

How can I get this to work?

Jun 26 '06 #3

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

Similar topics

7
by: William Ryan | last post by:
Are you using an intranet or the internet to push the updates? If the internet, you probably can't get there without a web server. If you are using an intranet, you can do it from a shared...
0
by: jmd | last post by:
Hello. I want to write a C# program that does completely automatically what, until now, I do manually, witch is describe below : 1. I launch IE (6) 2. I browse to my desired download page, say...
2
by: Trygve Lorentzen | last post by:
Hi, I'm developing an app with automatic version checking and updating. It must also track what version is installed for each customer in our customer database. I have made a small client to...
1
by: Iulian | last post by:
Hi, I am working on a directory type of site and I got stuck in the following problem: when the user clicks on the download link I present a page that sais: "Contacting download site... If the...
18
by: jmd | last post by:
Hello, I posted the following in the C# forum but without one answer. But perhaps now in vb.net someone has some guidelines ! This is my question : I want to write a vb.net program that does...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
0
by: ar | last post by:
Hello, In IE I disable "Automatic prompting for file downloads" which causes the IE information bar to show up when I try to push a file download from an iframe. I want to keep this behaviour. ...
6
by: Mike Saunders | last post by:
I have a basic web site where people can download my programs. To make it easier for them is it possible that I could add some javascript that would allow them to automatically install/run the...
25
by: sidd | last post by:
In the following code: int i = 5; ---it goes to .data segment int j; ---it goes to bss segment int main() { int c; int i = 5; ---stack
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.