In the last post I was talking about writing a simple UI extension which would appear like below:
How about you adding this to the IIS manager hierarchy – just below “Application Pools” and “FTP Sites”? Here is what you need to do additional to the steps you followed using my previous blog on this.
- Add a new class to the project and name it as MyHierarchyProvider, and the file as MyHierarchyProvider.cs
- MyHierarchyProvider should derive from Microsoft.Web.Management.Client.HierarchyProvider
- It should have an internal class deriving from Microsoft.Web.Management.Client.HierarchyInfo where you can extend few properties to specify the display text, and which ModulePage it links to.
Below is a sample code which would define a class deriving from HierarchyProvider, and has an internal class with all its properties set.
After doing above, you might also want to make some changes in your existing Module class, so that it has the information about the hierarchy. If you have downloaded the sample which I have linked in my earlier post, you should be having 2 lines commented (I forgot to remove them last time.. lol) – uncomment them, and you are good to go. However below are the 2 lines which you need to add to link this hierarchy provider with our module.
IExtensibilityManager extensibilityManager = (IExtensibilityManager)GetService(typeof(IExtensibilityManager));
extensibilityManager.RegisterExtension(typeof(HierarchyProvider), new MyHierarchyProvider(serviceProvider));
This would register the HierarchyProvider class to our module, and after building our assembly, and placing the DLL in GAC successfully, and after having all the administrationHost.config settings, you must see the below:
And, you can change the Text property of our HierachyInfo which is an internal class to change the display name appearing in the UI. Don’t hesitate to put your questions or anything you want to let me know through comments!