DynamicContent only showing when I'm logged in

Posted by Community Admin on 03-Aug-2018 06:39

DynamicContent only showing when I'm logged in

All Replies

Posted by Community Admin on 02-Nov-2012 00:00

I built a custom module with a custom MVC widget to output the data. I used the code provided in the Module Builder examples to output a collection, nothing special.

Here's the problem, it works perfectly if I am logged in, but when an anonymous visitor loads the page, I get an error that says, "Sequence contains no elements".

Has anyone else had an issue with custom module content only appearing if you are logged in?

I'm running 5.2.3700 if that matters.
Thanks, 
Dan

Posted by Community Admin on 02-Nov-2012 00:00

...try to figure it out all evening, and I solve it 2 minutes after I post... :-P

for whatever reason (likely I missed something in the release notes), moving from 5.0.2523 to 5.2.3700 requires that I add a line to suppress security checks in order to allow anonymous viewers. In my case, authenticated editors make changes, but anyone (anon) can view the output.

// after
DynamicModuleManager dynamicModuleManager = DynamicModuleManager.GetManager();

// add this line to allow anonymous viewers to view the output
dynamicModuleManager.Provider.SuppressSecurityChecks = true;


Hope this helps someone. :-)

Posted by Community Admin on 01-Mar-2013 00:00

thank you for providing your solution. This helped me out!

This thread is closed