State Your Destination Posts

The DotNetNuke Client API has always seemed mysterious and confusing to me, so much so that I phased it out of a module I wrote a while back in favor of an AJAX web service. But there are certain parts that are useful, namely the ability to store values on the server side for use on the client side, and vice-versa. I recently ran into an issue using it that fortunately was simple to fix. I have a module that will be accessed anonymously, with no user login at all. I was having trouble using the DNN namespace in client script because the browser said it couldn’t find it, which didn’t make any sense at all. Somewhere during the login process all the namespaces get exposed, because once I logged in things worked as expected.

The key was calling DotNetNuke.UI.Utilities.ClientAPI.RegisterClientReference in Page_Load of the page where I was trying to use the API. The API documentation mentions that routine, but the context was such that I only expected to need to call it if I was using a version of DNN prior to 4.0 (I had 4.9.0) In any case, it’s fixed and the module development continues apace. My thanks go to Jon Henning, creator of the API, for the tip.