Removing or Changing Sitefinity Page Extensions

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

Enjoyed this post and/or found it useful?
Tagged with:
SelArom Dot Net Profile Image
SelAromDotNet

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.



Scroll to top