Search code examples
n2cmsn2

In N2CMS, can you disable the prompt to 'Update links leading to' the item you just edited?


I am using N2CMS to manage the content of my site without using the page routing from N2. Hence when I edit a piece of content, it's quite useless when N2 asks me: "Update links leading to..." "Add permanent redirect at previous URL?". Can I disable this behaviour?


Solution

  • Converting Page into Part is inherently bad idea. It may be temporary fix for the problem you have, but it will bounce back at you in a bad way.

    Instead, you can do this

    • Turn LinkTracker off in web.config

      linkTracker enabled="false" permanentRedirectEnabled="false"
      
    • Copy CommandFactory.cs from N2 Source into your solution, and rename it to MyCommandFactory.cs. Add Service replacement attribute

      [Service(typeof(ICommandFactory), Replaces = typeof(CommandFactory))]
      

    In a constructor, change this line

    updateReferences = new MyUpdateReferencesCommand();
    
    • Write your own empty Update reference command class

      public class MyUpdateReferencesCommand : UpdateReferencesCommand
      {
          public override void Process(CommandContext state)
          {
          }
      }