How to count the number of times a topic is viewed?

 <p>Hi friends</P>

<p>What is the way to count the no. of clicks on a hyperlink, or saying other way,  to count the no. of times a topic is viewed?</P>

Seek knowledge to seek nearness to God!!
4/30/2009 10:07:14 PM 8807 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 15

If the clicking on the topic loads another aspx page, i would put some code in that page load event that reads a counter from a database, increments it and then stores it back to the database.  If you don't care about retaining the counter after the application restarts, set up an application variable, eg. Application.Get("TopicCounter") that gets incremented and then saved via Application.Set("TopicCounter").

You can also take advantage of the Global.aspx to load and save Application variables if you want to reduce the number of writes to a database.

I'm sure many other methods can be derived.

I hope that helps!

Eric Welller

4/30/2009 11:24:15 PM

If you read from a database each time you can have a counter on the database table and increment the counter in the stored proc that reads the data.  If you are caching (which is the preferred design option) then you will still need to store a transaction somewhere but this can be written to a queue.  Then, process the queue offline to update the counters.  It depends on you what you feel the best way of counting is, whether you place it in a web form or in a custom HTTP module.

5/1/2009 4:13:08 PM
Alright. I will do it this way. The only thing I need to do is to increment a field in database. Then some lines of codes in the page_load event will do the trick.
Thanks to both of you.
Seek knowledge to seek nearness to God!!
5/3/2009 4:09:20 AM

Similar Artilces:

How to count the number of times a page is viewed
hiiiiiiii,        i am developing a forum and i want know "How to count the number of times a page is viewed". please click 'Mark as Answer' if my post helped you. Hi, You should have a table in your database with a Hit field . And in the  page load event of  page add  codes for adding 1 to the hit field. in this way you have the number of page viewed in hit field. I hope it can help you. I think this link may help you.... Happy C...

count the number of times a record appears in a table ant output the count to that particular item in a gridview
 i have another gridview and i need to be able to on each row compare the primary key with another table to see how many times the primary key appears in the other table and then output that in another template feild as the count.Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete        AccessDataSource2.SelectCommand = "SELECT Material FROM Rejection"        Dim col As System.Data.DataView        col = AccessData...

Best practices for page view counts (profile page view count/forum thread count, etc)
First of all, I apologize if this is in the wrong forum... I'd like to implement counting page views which will be updated to Sql server when a user visits that page.  However I was curious what would be the best way to prevent someone from just refreshing the page to increase the page count, of course, after a certain period if they were to return, it probably should increase again, I just don't want someone to be able to continually hit refresh and then their page count isn't really accurate.  Thanks for any help! There are may ways to perform these . You can wri...

State Management; .Net Profiler
Here is the situation with the customized profiler. I got a profiler class called SSOProfileProvider inheriting from ProfileProvider. I've implemented the Initilization, GetPropertyValues and SetPropertyValues. The Get... and Set.. are making a call to the database to store profile into the database. This class has been stored in the separate DLL called "Security.DLL" and there is a web site that is using this dll. The web.Config for this website is as follow:<profile enabled="true" inherits="AppProfileBase" defaultProvider="SSO" automat...

Count number of times matched
Hi folks, If I want to count the number of times that a match occurs in a line is there a way of doing this, if there is I have not found it! e.g. $line="This is a sentence about matching sentences.\n"; $line=~/sentence/ig; So I will have matched "sentence" twice and I want to record this. I can do it like this: $line=~/sentence/ig; # count the number of instances of this in the sentence @split=split(/sentence/,$line); $length=@split; $length--; This code works fine, but if I need to keep each matc...

how to increase time of view state
Can any body tell me how can i increase the view state time ? whats the default time ? is there any to see all the configuration variables of .net framework? what would be the adverse effects on server of increasing viewstate time ? Thanks ,, ViewState is stored in the page itself on the client. There is no time limit. Data will only be destroyed when the page is closed. The only adverse effects is slower posting and response as the data gets larger....

managing view state..i m online..
how can i manage view state of a usercontrol having dropdownlist bounded with data,and the condition is the user controls r also dependent of the dropdownlist in parent page. if there is some coding plz provid that to me. WITH REGARDSRuchiPunetha...

Tracking the number of times a page has been viewed
Whats the best way to implement this? I've heard that if multiple updates are performed on the same record in a database at exactly the same time, one or more of the updates may not occur? Any help would be very much appreciated. Thanks.   Well i hope you don't want to kill your database server. You can simply keep an array of values in Application and dump it in database after a number of requests ... let's say (1000). If your site is visited quite often, that would require 50 visitors and 30-40 minutes of slow browsing. Also you can keep complex objects for each...

Counting number of times word repeated in a string
Hi guys, I need to know how I can scan a string for a specific word? I have searched online and all I can find is guides on how to count the number of words or letters. I need to be able to count the number of times a word is repeated. I thought about using the InStr() command but when I use the following code: response.write(InStr("This is my message message", "message")) It doesn't detect that the word "message" is repeated twice, it just gives me a result of 1. Does anyone know how I would get it to count the repeated words? How about...

error while viewing view in .net
xp x64 OS sql any 10 .net provider asa 8.3 server trying to run a view with typed dataset with computed columns generate error. i will update the error message attachment in the next post. thanks vsv "vsv" <> wrote in message news:46a7f128$1@forums-1-dub... > xp x64 OS > sql any 10 .net provider > asa 8.3 server > trying to run a view with typed dataset with computed columns generate > error. > i will update the error message attachment in the next post. > thanks > vsv > > begin 666 errorInSQLAnywh...

Session State and View State
Hi Everyone, Can anybody tellme how are these used in context with ASP.NeT whats their sole purpose?.....and where in programming we use  them? Any links or sources would be good which explains in simple terms.   thanks Simi  ThanksSimi------------&------------"To learn to succeed, you must first learn to fail." -Michael Jordan Here is one of the discussion never desire to converse with a man who has written more than he hasread. -Samuel Johnson, lexicographer (1709-1784)  Hi There is a video tutorial a...

count total number of page views of website
hi,  i need to count the total number of page views of my site.. is there any solutions available? (Except Global.aspx file) or any third part control is available?Thanks.  Here is a brief tutorialyour question is vague because there are number of counter types.The above link will, I believe, help you to make the first step.HTHIvo Stoykov The problem with counting page views yourself (i.e. using your own code) is that you then have the task of determining which visits are spiders, crawlers, bots, etc and which visits are actual users.  I would think you'd be interested...

Usage scenarios for view state, session state, application state, cookies
Hi Guys, Im a college student in London with exams starting Monday on ASP.NET with C#.  Id be so grateful if you could provide me with solid real world scenarios/examples of when you would use the following to maintain state and why you would use them in that instance:   View State Session State Application State Cookies Also when would you use SOAP instead of the REST architecture and vice versa and why - again real world usage scenarios?  I note Amazon's web service uses the REST architecture - why is this, why dont they use SOAP. Id be grateful for a timely respon...

COunting the number of times a string matches in another string
Hi! Maybe this is really easy, but hey, I'm a beginner with Perl. I'm trying to count the number of times a string is contained inside another string. Here's a sample of my data, a set of colon-delimited values from the Perl Soundex function, with a few pure numbers or letters mixed in. A sample candidate string: :B000:W000:M260:8: For each colon-delimited substring, such as :M260:, I want a count of how many times it's found in each target string. Some sample target strings: :L520:T400:C000:S000:L200:8: <-bare numbers are possible, like this ...

Web resources about - How to count the number of times a topic is viewed? -

List of most viewed YouTube videos - Wikipedia, the free encyclopedia
^ Videotrine. "The most viewed videos on Youtube in the World of all time" . YouTube , Dailymotion . Retrieved October 5, 2013 . Sanneh, Kelefa ...

Esquire Network Facebook Fans Are ‘Lucky Bastards,’ As They Viewed Show’s Debut Episode Early
New Esquire Network series “Lucky Bastards” debuts at 10 p.m. Wednesday, but Facebook users didn’t have to wait to see the first episode of the ...

The Value of Viewed Impressions
At Facebook, we use viewed impressions to measure ad delivery. Here’s why.

Watts Up With That? - The world's most viewed site on global warming and climate change
The world's most viewed site on global warming and climate change

Who Viewed Me? ( For Facebook ) Lite on the App Store on iTunes
Get Who Viewed Me? ( For Facebook ) Lite on the App Store. See screenshots and ratings, and read customer reviews.

South Korea Viewed from the North - Flickr - Photo Sharing!
Joint Security Area; Panmunjom, DPRK (North Korea)

Microsoft Kinect working with Autodesk Showcase and viewed in 3D stereo - YouTube
Developed by one of our 3rd year computing students at the University of Northampton (School of Science and Technology), this application is ...

Ford Still Viewed More Favorably Than GM, Chrysler
More Americans than ever have a favorable opinion of Ford, the one Big Three automaker who didn't need a taxpayer bailout to stay in business. ...

Julia Gillard cried when she found out Kevin Rudd viewed her as disloyal, former PM tells Ray Martin
Julia Gillard was so upset at being viewed as disloyal by Kevin Rudd that she broke down in tears on the day she challenged him for leader.

The Most Viewed YouTube Videos of 2009
YouTube published a list of its most viewed videos of the year on its blog today. The list is broken in to two categories, music videos and everything ...

resources last updated: 11/20/2015 11:43:28 AM