Engage on Facebook Engage on Twitter Engage on LinkedIn Engage on GitHub components notes mobile card heart 2 infinite mirror 2 pricing

Getting the current PortalId outside of PortalModuleBase

By Brian Dukes

It's occasionally tricky/troublesome to pass the current Portald from your DotNetNuke control that inherits PortalModuleBase so that it can be used in your business object logic. A trick that I learned looking at another developer's code recently is to get the current PortalId from PortalController.GetCurrentPortalSettings().PortalId. CurrentPortalSettings is set for every request, so it is always the value that you are looking for.

Hope it helps,

Planning a DNN upgrade? Download our guide