AdRotator - Detect duplicate images on page

Hi

I have 4 ad rotators on the one page.  I'd like to have them all using the same XML file / db query, but would like to ensure that there's no duplicate images shown.

I figured I could create a collection of displayed images on the page, and use the adcreated event to capture the ad being displayed, check the collection and if no duplicates, display it.

However, if it IS duplicated, how do I get the control to select the next from the list.  I intend to use the Impressions tag to provide weighted impressions, so would like to allow the adrotator to continue managing the selection of the next image.  Is there a way I can do this?

Any alternative approaches would be accepted!

Marty
martypittAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rundkaasCommented:
Yes I would belive that a manual approach would be best suited, so I would go for the adCreated event.
Here is some psudocode that may help:
    private List<Ad> collection;
protected void adRotator_AdCreated(object sender, AdCreatedEventArgs e)
    {
        if (collection == null)
        {
            populateCollection();
        }
        reset();
        Random rand = new Random();
        //get a random ad, or add support for the weighted impressions
        Ad a;
        while (!(a = collection[rand.Next(0, collection.Count)]).Used)
        {
            //bind the unused ad
            //and set it to be used
            a.Used = true;
        }
       
    }
    private void populateCollection()
    {

    }
    private void reset()
    {
        //sets all ads to unused
    }
What remains to be implemented is the Ad class, the population method and a more sophisticated selection.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rundkaasCommented:
clarification there should be a break in the while, after a.Used = true;
Also this eventListener should be added to all adRotators
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.