Dealing with replacement of two depcrecated methods somewhat releated in our code.
This first one, I see has its own threads, so I will avoid it.
'Public Overloads Function NavigateURL() As String' is obsolete: 'Deprecated in Platform 9.4.2.
The one I am interested in is commonly used as a paramter to the first:
'Function GetCurrentPortalSettings() As PortalSettings' is obsolete: 'Deprecated in Platform 9.4.2.
I replaced
Dim PortalSettings As Entities.Portals.PortalSettings = Entities.Portals.PortalController.Instance.GetCurrentPortalSettings
With the new interface version
Dim PortalSettings = Entities.Portals.PortalController.Instance.GetCurrentSettings.
But this property that was available before is no longer.- PortalSettings.ActiveTab.TabID
Where can I find missing properties?
I would use TabController.CurrentPage in place of PortalSettings.ActiveTab.
TabController.CurrentPage
PortalSettings.ActiveTab
Mac, you'll need to use the INavigationManager.NavigateURL method instead. How you obtain an INavigationManager instance varies based on your development paradigm.
INavigationManager.NavigateURL
INavigationManager
At a high level, the answer is that you'll request one from the dependency injection container. If you're using MVC controllers or Web API controllers, you can just add a parameter to your controller's constructor and the framework will supply that dependency automatically. Here's a Web API controller example:
Imports DotNetNuke.DependencyInjection Imports Microsoft.Extensions.DependencyInjection Public Class MyController Inherits DnnApiController Private ReadOnly navigationManager As INavigationManager Public Sub New(ByVal navigationManager As INavigationManager) Me.navigationManager = navigationManager End Sub End Class
You can see a fuller discussion with more examples at https://dnncommunity.org/forums/aft/2002#5875. Hope it helps!
Very good info guys, thanks. I had read through the thread referenced and it seemed to be a very complex solution. I think that because our design is using web forms rather than mvc, maybe it simplified my fix. I almost dont trust it yet . I had found the reply that Joe mentioned and used it to make this modification and it worked. I will have to add the references and imports to multiple modules where we were using the NavigateURL. If there is a flaw that you can see here, please let me know. Private Sub lbtnGoHome_Click(sender As Object, e As EventArgs) Handles lbtnGoHome.Click Dim lcPortalController As New DotNetNuke.Entities.Portals.PortalController Dim lcPortalInfo As New DotNetNuke.Entities.Portals.PortalInfo lcPortalInfo = lcPortalController.GetPortal(Me.PortalId) Response.Redirect(DependencyProvider.GetRequiredService(Of Abstractions.INavigationManager).NavigateURL(lcPortalInfo.HomeTabId), False) ' replaced .... Response.Redirect(DotNetNuke.Common.NavigateURL(lcPortalInfo.HomeTabId, False))
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.