We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,939 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How To Count Total No Of Downloads?

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
2
Contributors
1
Reply
29 Minutes
Discussion Span
2 Months Ago
Last Updated
5
Views
jaimin4829
Light Poster
25 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 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

hometownnerd
Light Poster
37 posts since Sep 2007
Reputation Points: 21
Solved Threads: 4
Skill Endorsements: 2

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0592 seconds using 2.7MB