Thursday 8 August 2013

How to Get the Current Portal ID in DotNetNuke

In DotNetNuke We can get the Current portal ID by using the PortalController class as follows.

In C#.NET:

int portalID = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings().PortalId;

In VB.NET:

Dim portalID As Integer = DotNetNuke.Entities.Portals.PortalController.GetCurrentPortalSettings().PortalId

Here in the above code GetCurrentPortalSettings() method returns PortalSettings object.  By using PortalsSettings object we are getting the PortalID.

No comments: