Removing or Changing Sitefinity Page Extensions

By in
No comments

When migrating to the latest Sitefinity from the old version 3.7, by default the original .aspx page extension remains intact. It is stored in the Extension property of the PageNode.

You can remove (or change) this extension with this simple code snippet:

using (var api = App.WorkWith())
{
	var pages = api.Pages().LocatedIn(PageLocation.Frontend).ThatArePublished()
		.ForEach(page =>
		{
			page.Extension = null;
		}).SaveChanges();
}

RemoveSitefinityPageExtensions.cs on Gist

The following two tabs change content below.

selaromdotnet

Senior Developer at iD Tech
Josh loves all things Microsoft and Windows, and develops solutions for Web, Desktop and Mobile using the .NET Framework, Azure, UWP and everything else in the Microsoft Stack. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom. His other passion is music, and in his spare time Josh spins and produces electronic music under the name DJ SelArom.