So you're still getting this error message?
'IServiceProvider' does not contain a definition for 'GetRequiredService' and no accessible extension method 'GetRequiredService' accepting a first argument of type 'IServiceProvider' could be found (are you missing a using directive or an assembly reference?)
Here's a patch of what changed to add INavigationProvider to a control inside DNN:
INavigationProvider
From 9a37ad164f11e8a258f16aa055659cbe2c703b78 Mon Sep 17 00:00:00 2001 From: Brian Dukes Date: Mon, 27 Jan 2020 09:28:25 -0600 Subject: [PATCH] Add NavigationManager to WebForms control --- .../Admin/Authentication/Authentication.ascx.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/DNN Platform/Website/DesktopModules/Admin/Authentication/Authentication.ascx.cs b/DNN Platform/Website/DesktopModules/Admin/Authentication/Authentication.ascx.cs index 5f0153433a..483646c003 100644 --- a/DNN Platform/Website/DesktopModules/Admin/Authentication/Authentication.ascx.cs +++ b/DNN Platform/Website/DesktopModules/Admin/Authentication/Authentication.ascx.cs @@ -9,12 +9,16 @@ using System.IO; using System.Web.UI; using System.Web.UI.HtmlControls; + +using DotNetNuke.Abstractions; using DotNetNuke.Entities.Modules; using DotNetNuke.Services.Authentication; using DotNetNuke.Services.Localization; using DotNetNuke.UI.Skins.Controls; using DotNetNuke.UI.UserControls; +using Microsoft.Extensions.DependencyInjection; + #endregion namespace DotNetNuke.Modules.Admin.Authentication @@ -27,8 +31,14 @@ namespace DotNetNuke.Modules.Admin.Authentication /// public partial class Authentication : PortalModuleBase { + private readonly INavigationManager _navigationManager; private readonly List _settingControls = new List(); + /// + public Authentication() + { + this._navigationManager = this.DependencyProvider.GetRequiredService(); + } protected override void OnLoad(EventArgs e) { -- 2.25.0.windows.1
Hi Brian,
yes, I am still on this error. The only difference I see is here:
this._navigationManager = this.DependencyProvider.GetRequiredService();
In my code it reads as
_navigationManager = DependencyProvider.GetRequiredService();
Thanks for your patience.
Happy DNNing! Michael
two are custom stuff, but here are the other references ({ = <, } = >):
{Reference Include="DotNetNuke, Version=6.1.1.12, Culture=neutral, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\DotNetNuke.dll{/HintPath} {/Reference} {Reference Include="DotNetNuke.Abstractions, Version=9.4.4.0, Culture=neutral, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\DotNetNuke.Abstractions.dll{/HintPath} {/Reference} {Reference Include="DotNetNuke.DependencyInjection, Version=9.4.4.0, Culture=neutral, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\DotNetNuke.DependencyInjection.dll{/HintPath} {/Reference} {Reference Include="DotNetNuke.Web"} {HintPath}..\..\bin\DotNetNuke.Web.dll{/HintPath} {/Reference} {Reference Include="Custom1, Version=1.9.1.8, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\Custom1.dll{/HintPath} {/Reference} {Reference Include="Custom2, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\Custom2.dll{/HintPath} {/Reference} {Reference Include="Microsoft.ApplicationBlocks.Data, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\Microsoft.ApplicationBlocks.Data.dll{/HintPath} {/Reference} {Reference Include="Microsoft.Extensions.DependencyInjection, Version=2.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"} {SpecificVersion}False{/SpecificVersion} {HintPath}..\..\bin\Microsoft.Extensions.DependencyInjection.dll{/HintPath} {/Reference} {Reference Include="System" /} {Reference Include="System.Data" /} {Reference Include="System.Data.DataSetExtensions" /} {Reference Include="System.Drawing" /} {Reference Include="System.Web" /} {Reference Include="System.Web.ApplicationServices" /} {Reference Include="System.Web.DynamicData" /} {Reference Include="System.Web.Entity" /} {Reference Include="System.Web.Extensions" /} {Reference Include="System.Xml" /} {Reference Include="System.Xml.Linq" /} {Reference Include="WindowsBase" /}
Hi Michael/Brian Sadly [for me] I'm an occasional Basic Code producer of DNN Modules. I have a a couple of modules that have worked fine for four years... until I 'upgraded' to DNN 9.5.0 which appears [I think] to be broken in that calls to NavigateURL is generating very odd behavior.
I have a Development machine that, after compilation, works fine.
On the Operational machine, It seems that the Request.Params being passed to an editing sub-form have 'moved up one' in that Params((3) is now Params(4). As a result, I get errors across the piece.
I've read the dialog between Brian and Michael... didn't really understand much of that but if you could point me at a basic code example of how the new NavigateURL mechanism is implemented, that would be great.
... Still not at all sure why it works in one machine and not the other... the /bin DlLLs are all precisely the same, so I suspect some Microsoft based software is at fault. Any ideas?
Regards and in some desparation, Duncan
In Visual Basic.NET, the base of indexers can be set to 0 (the default) or 1 (see Option Base statement docs). So it's possible that something in your toolchain is changing the base, which would result in this kind of error. I don't think it would have anything to do with the new INavigationManager.
Option Base statement
INavigationManager
update: I've been chasing a ghost.
Because I use Request.Params to pass a number of parameters to sub-dialogs, [which has always worked...]. And when I updated to 9.5.0 I casually added a local language [English:UK] to the site... DotNetNuke added that to each parameter set ! :)
... A lesson learned.
However, I'd still like to see a Basic Code example of the update to NavigateUrl() function as that will be removed in version 11.0
regards, Duncan
Here is a full synopsis of how to move from the old NavigateURL to the new method References for your project must be made to:
Each of these returns a string which you can then do redirects with or whatever.
If you want to circumvent the call to DotNetNuke.Abstractions you can call it like this: DependencyProvider.GetRequiredService(Of Abstractions.INavigationManager).NavigateURL(PortalSettings.ActiveTab.TabID, "YourControlKey", "mid=" & CStr(ModuleId))
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.