BannerInfoProvider.GetRandomValidBanner(int, bool) Returns Same Banner Every Time

kentico guy asked on July 24, 2020 18:28

We are experiencing an issue with Kentico where the GetRandomValidBanner(int, bool) method is returning the same banner every time. Is there any way I can debug this, since it's a compiled assembly? We have multiple banners with categoryID = 1. If I disable to only one banner, this returns a different BannerInfo.. but if there's multiple active banners it's returning the same one every time.

Has anyone ever seen this? What should I do? I was thinking I could extend the class then override it, but wanted to check with yall first, since you usually have good info for me.

Also, I don't see any way to change the BannerCategoryId: what does that do, and how can I change it?

EDIT: Also, we're running K12 Portal Engine hotfix 12.0.15

Please advise, ~KG

Recent Answers


Brenden Kehren answered on July 24, 2020 18:56

Assuming you're using the web part, I'd suggest setting the web part's caching to 0. It's most likely caching the data upon retrieval.

Another option is to simply use a repeater and select the TOP 1 and set the order by property to newid(). This works every time no matter what your caching settings are.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.