1.11M Members

How To Count Total No Of Downloads?

 
0
 

Hi i am developing a web site to download softwares.I want to get total no of downloads of softwares.hOw can i get actual values of downlod??

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
            Response.Redirect("../Mysoftwares/" & dset.Tables(0).Rows(0).Item(1).ToString() & ".exe")

End Sub



    'code to redirect at softwares folder to download
 
0
 

Personally I would think you would want a DB that would house the info you are trying to store. Then before you perform the redirect I would place the data in the database table and also you may want to store as much info about the user as possible as well.

Dim strConn as string = "server=serverip;uid=DBusername;pwd=password;database=DownloadsDB;Max Pool Size=2000;Application Name=Downloader"
Dim cnind As SqlConnection = New  _
                   SqlConnection(strConn)
        cnind.Open()

        Dim cmdind As New SqlCommand

        cmdind.Connection = cnind
        cmdind.CommandTimeout = 1600
        Dim sqlind As String
        dim userip as string 'set this equal to the user IP from the request strings
        dim filename as string 'set this equal to the filename you are sending to them
        dim filedirectory as string 'set this equal to the directory the file is being pulled from
        sqlind = "insert into Downloads (userip, directory, filename, datetime) values ('" & userip & "', '" & filedirectory & "', '" & filename & "', '" & now() & "')"


        cmdind = New SqlCommand
        cmdind.Connection = cnind
        cmdind.CommandTimeout = 1600

        cmdind.CommandText = sqlind

        cmdind.ExecuteNonQuery()
        cmdind.Dispose()
        cnind.Close()
        cnind.Dispose()

This would need a database called "DownloadsDB" and a table called "Downloads" with 4 fields....userip, directory, filename, datetime.
This may work for you but may need to make some changes, let me know if you need any more help. Getting the IP and the other fields is reasonably easy to do, I just did not include it in this.

Let me know,
Larry

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: