I wrote a Custom Search method (GetSearchItems) in my Controller class and it works fine on my desktop computer where I do development. On my hosted dedicated server, the site works fine but the code in the Custom Search method is having trouble getting the PortalID. Below are the relavant lines of code. The line "Dim thisPortalID As Integer = thisPortal.PortalID" throws the exception.
'Imports
Imports System
Imports System.Configuration
Imports System.Data
Imports System.XML
Imports System.Web
Imports System.Collections.Generic
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities.XmlUtils
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Services.Search
'Class declaration
Public Class MyController
Implements Entities.Modules.ISearchable
...
'Custom Search Method
Public Function GetSearchItems(ByVal modInfo As Entities.Modules.ModuleInfo) As SearchItemInfoCollection Implements Entities.Modules.ISearchable.GetSearchItems
Dim searchItems As New SearchItemInfoCollection
Dim item As HSStyleMasterInfo
Dim controller As New HSStyleItemController
Dim items As List(Of HSStyleMasterInfo) = controller.GetStyleMasterItems("ActiveStyle = 1")
Dim limit As Int16 = 100
Dim thisPortal As New DotNetNuke.Entities.Modules.PortalModuleBase
Dim thisPortalID As Integer = thisPortal.PortalId
...