5

Does anyone know how to create a custom admin page in sitecore 9 and also have it display on the list on the admin page?

5

In Sitecore all admin pages are aspx pages. You need to create your own aspx page to create your custom admin page.

To add to the list of admin pages you need to override : c:\inetpub\wwwroot\yourlocalfolder\sitecore\admin\default.aspx page

Codebehind for this page is in class: Sitecore.ExperienceContentManagement.Administration.Default

You have to look into OnLoad method where are added all admin pages :

protected override void OnLoad(EventArgs e)
    {
      AssemblyInformationalVersionAttribute customAttribute = Assembly.GetAssembly(typeof (Default)).GetCustomAttributes(typeof (AssemblyInformationalVersionAttribute), false)[0] as AssemblyInformationalVersionAttribute;
      Assert.IsNotNull((object) customAttribute, "assemblyInfoVersion is null");
      this.Version.Text = customAttribute.InformationalVersion;
      List<Default.PageDescription> pageDescriptionList = new List<Default.PageDescription>()
      {
        new Default.PageDescription()
        {
          Name = "Event Queue Statistics",
          Description = "An overview of the Event Queue" + (DataProviderHelper.IsOracleEnabled ? ".<br/><i style=\"color: red;\">This page is not supported for Oracle provider.</i>" : string.Empty),
          Link = "/sitecore/admin/EventQueueStats.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Database Cleanup",
          Description = "Perform various cleanup operations on specific databases",
          Link = "/sitecore/admin/DBCleanup.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Jobs Viewer",
          Description = "An overview of the jobs",
          Link = "/sitecore/admin/Jobs.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Package Item",
          Description = "Make a package of items and their dependencies",
          Link = "/sitecore/admin/PackageItem.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Publish Queue Statistics",
          Description = "An overview of the Publish Queue",
          Link = "/sitecore/admin/PublishQueueStats.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Raw Search",
          Description = "Search for the specific string in a database or in the file system" + (DataProviderHelper.IsOracleEnabled ? ".<br/><i style=\"color: red;\">The database search is not supported for Oracle provider.</i>" : string.Empty),
          Link = "/sitecore/admin/RawSearch.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Rebuild Reporting Database",
          Description = "Rebuild the Reporting database",
          Link = "/sitecore/admin/RebuildReportingDB.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Security Tools",
          Description = "Login and user management tools",
          Link = "/sitecore/admin/SecurityTools.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Sql Shell",
          Description = "Use connection strings to execute SQL scripts" + (DataProviderHelper.IsOracleEnabled ? ".<br/><i style=\"color: red;\">This page is not supported for Oracle provider.</i>" : string.Empty),
          Link = "/sitecore/admin/SqlShell.aspx"
        },
        new Default.PageDescription()
        {
          Name = "User Info",
          Description = "Logged in user details",
          Link = "/sitecore/admin/UserInfo.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Cache",
          Description = "An overview of the caches",
          Link = "/sitecore/admin/cache.aspx"
        },
        new Default.PageDescription()
        {
          Name = "DB Browser",
          Description = "The interface for various item manipulations",
          Link = "/sitecore/admin/dbbrowser.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Install Language",
          Description = "Install a new content language",
          Link = "/sitecore/admin/InstallLanguage.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Pipeline Profiler",
          Description = "An overview of pipeline execution",
          Link = "/sitecore/admin/pipelines.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Remove Broken Links",
          Description = "Remove broken links from a database",
          Link = "/sitecore/admin/RemoveBrokenLinks.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Restore Item",
          Description = "Restore items from the archive",
          Link = "/sitecore/admin/restore.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Serialization",
          Description = "Serialize and revert a database",
          Link = "/sitecore/admin/serialization.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Set Sitecore Application Center Endpoint",
          Description = "Change the endpoint address of the App Center",
          Link = "/sitecore/admin/SetSACEndpoint.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Show Config",
          Description = "Merge configuration files",
          Link = "/sitecore/admin/ShowConfig.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Show Config Layers",
          Description = "Merge configuration files depending on configuration layers and roles",
          Link = "/sitecore/admin/ShowConfigLayers.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Dependency Injection Configuration",
          Description = "Check the configured services",
          Link = "/sitecore/admin/ShowServicesConfig.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Rendering Statistics",
          Description = "An overview of the performance of renderings",
          Link = "/sitecore/admin/stats.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Unlock Admin",
          Description = "Unlock Admin user",
          Link = "/sitecore/admin/unlock_admin.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Update Installation Wizard",
          Description = "Install Sitecore updates",
          Link = "/sitecore/admin/UpdateInstallationWizard.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Logs",
          Description = "View and download Sitecore log files",
          Link = "/sitecore/admin/Logs.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Media Hash Generator",
          Description = "Generate hash values for dynamic image scaling URLs",
          Link = "/sitecore/admin/MediaHash.aspx"
        },
        new Default.PageDescription()
        {
          Name = "Support Package",
          Description = "Generate a package with support information",
          Link = "/sitecore/admin/SupportPackage.aspx"
        }
      };
      Repeater pagesRepeater = this.PagesRepeater;
      List<Default.PageDescription> source = pageDescriptionList;
      StringComparer ordinalIgnoreCase = StringComparer.OrdinalIgnoreCase;
      IOrderedEnumerable<Default.PageDescription> orderedEnumerable = source.OrderBy<Default.PageDescription, string>((Func<Default.PageDescription, string>) (p => p.Name), (IComparer<string>) ordinalIgnoreCase);
      pagesRepeater.DataSource = (object) orderedEnumerable;
      this.PagesRepeater.DataBind();
    }
  • This is for sitecore 9? Currently if I put [site]/sitecore/admin/default.aspx it will forward me to [site]/sitecore/admin/ Currently we have the aspx pages I would just like to have them visible from [site]/sitecore/admin/. I see all those entries are in the main.bundle.js file. It's really not ideal to modify this file but this solution is looking me right in the eye... I'm wondering if sitecore left a better entry point. – Mok Feb 27 at 21:30
  • I don't see a better entry point to customize that admin page. – Vlad Iobagiu Feb 28 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.