By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,304 Members | 3,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,304 IT Pros & Developers. It's quick & easy.

Exteding the AdRotator Control and Advert.xml file to track advertstats

P: n/a
MC
I've been using the ASP.NET ad rotator for some time and have been asked
to track the hits and click thrus, The solution that seemed obvious to
me was to extend the existing control to record the Display count and
then rewrite the URL location to be passed as a paramter to a page which
records the click count and redirect to the intended page.

This all seems to work fine. My next thought was that the most logical
location for the Click and Display count was in the Ads.xml file used to
control the AdRotator. This works however, I get Errors because the file
is locked by the AdRotator.

I currently catch the error and continue, what would be the correct way
to deal with this situation and ensure that the hit gets recorded?
Oct 2 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi MC,

My opinion on such scenario would be to use database instead of a file to
track the click count. Just insert a record for each click and later use
"select count..." to get total click count of a specific AD.

Here's some example code for your reference:

#Superexpert - Listing 4.14 - AdRotatorTrack.aspx
http://www.superexpert.com/Books/Asp...pter4/Listing4
_14.aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 3 '07 #2

P: n/a
MC
True, In the past I would have agreed, however one could argue that the
XML file is a "Database" of sorts, I was trying to avoid the overheads
of another (SQL) database in my site.
The simplicity of this solution was what interested me as I already have
a sophisitcated XML file handling utility class which has meant that I
only needed to add 4 lines of code to an overriden usercontrol to
impliment the majority of the functionality.

So thanks for the Sql Solution, but I'm still interested in finding out
the recomended safe way to update the XML file that may be in use by the
AdRotator for rendering or other instances also tring to update.

Regards
Mike Caddy

Walter Wang [MSFT] wrote:
Hi MC,

My opinion on such scenario would be to use database instead of a file to
track the click count. Just insert a record for each click and later use
"select count..." to get total click count of a specific AD.

Here's some example code for your reference:

#Superexpert - Listing 4.14 - AdRotatorTrack.aspx
http://www.superexpert.com/Books/Asp...pter4/Listing4
_14.aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 3 '07 #3

P: n/a
MC
True, In the past I would have agreed, however one could argue that the
XML file is a "Database" of sorts, I was trying to avoid the overheads
of another (SQL) database in my site.
The simplicity of this solution was what interested me as I already have
a sophisitcated XML file handling utility class which has meant that I
only needed to add 4 lines of code to an overriden usercontrol to
impliment the majority of the functionality.

So thanks for the Sql Solution, but I'm still interested in finding out
the recomended safe way to update the XML file that may be in use by the
AdRotator for rendering or other instances also tring to update.

Regards
MC

Walter Wang [MSFT] wrote:
Hi MC,

My opinion on such scenario would be to use database instead of a file to
track the click count. Just insert a record for each click and later use
"select count..." to get total click count of a specific AD.

Here's some example code for your reference:

#Superexpert - Listing 4.14 - AdRotatorTrack.aspx
http://www.superexpert.com/Books/Asp...pter4/Listing4
_14.aspx

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 3 '07 #4

P: n/a
Hi MC,

Even if we could update the xml file "database", there's a high chance that
we will encounter locking issues since multiple requests can take place at
the same time and they all need to write to the xml file. Note IO
operations are slow, therefore such locking and IO errors will occur very
frequently.

On the other hand, database is much better handling such concurrent
operations, especially if you're inserting two irrelevant new records
(instead of updating a single record); and database operations are much
faster than IO operations.

Hope this helps.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Oct 3 '07 #5

P: n/a
MC
Ok, I agree, However the application is quite low traffic, I guess that
with time we will have more traffic and maybe the DB route is worth
doing now to save re-implimenting in the future, currently with the
simple "Try Catch Solution" there is about 2 IO errors a week.

Regards
MC

Walter Wang [MSFT] wrote:
Hi MC,

Even if we could update the xml file "database", there's a high chance that
we will encounter locking issues since multiple requests can take place at
the same time and they all need to write to the xml file. Note IO
operations are slow, therefore such locking and IO errors will occur very
frequently.

On the other hand, database is much better handling such concurrent
operations, especially if you're inserting two irrelevant new records
(instead of updating a single record); and database operations are much
faster than IO operations.

Hope this helps.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Oct 3 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.