Change banner every page refresh

Asked

Viewed 275 times

5

I have a list of 3 Banners.

I must always show each one different Refresh of Page, even after closing the browser.

I’m thinking about doing a fingerprint counter every time a Banner and shown adds + 1 to the counter and I do this check whenever I show.

But if you have 2 Banners registered and after several impressions a third party is registered would break this scheme, because only the last to be registered would be shown.

Someone suggests another way?

  • When you sign up/update the other banner you could then update the entire table and reset the counter, already thought about it ?

1 answer

2


I’m guessing your banner is on a banner list, something like List<Banner>:

banners.ElementAt(new Random().Next(0, banners.Count));
  • With that code always the first Banner would be shown when a new access was done right?

  • No. In this case he always picks up a random banner.

  • @gypsy-Morrison-Mendez how I would do it with js or jquery?

  • @Thiagodiniz Writing the structure using Razor and using a JS plugin to rotate the list. Ask a question that I answer for you.

  • @gypsy-Morrison-Mendez http://answall.com/questions/80406/script-trocar-imagem-a-cada-reload

Browser other questions tagged

You are not signed in. Login or sign up in order to post.