DynamicContent only showing when I'm logged in
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
...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. :-)
thank you for providing your solution. This helped me out!