How do I make a custom resource (e.g .aspx) available on a friendly URL in Episerver

  • Page Owner: Not Set
  • Last Reviewed: 2020-06-30

How do I make a custom resource (e.g .aspx) available on a friendly URL in Episerver?


Additional Posts

If this resource is not using a controller do not use MapPageRoute from the Route Initialization.

Find your Initialization Engine (GlobalInitialization.cs) and add the following

var host = context.Locate.Advanced.GetInstance<IHostingEnvironment>();
  if (host != null)
  {
    VirtualPathMappedProvider settingsMaps = new VirtualPathMappedProvider("SettingsMaps", new NameValueCollection());
    settingsMaps.PathMappings.Add("~/friendly-url", "~/file-resource.aspx");
    host.RegisterVirtualPathProvider(settingsMaps);
  }

Comments

  • I had trouble making this work for an ASPX page, but it works for remapping login URLs.