Emulating .aspx Urls created in Sitefinity v. 3.7
We are planning on upgrading to Sitefinity v. 4.1 SP3 from Sitefinity v. 3.7 SP4 on .Net 4.0.
We have developed several custom applications/User Controls which relied on the earlier Urls created by Sitefinity. These Urls have been sent to customers to check their profile information etc. on our website.
However, once we upgrade to Sitefinity v. 4.1 SP3, we have noticed that none of the Urls contain the name of the .aspx page in the Url, thus breaking all of the links that have been sent to our customers.
Is there any way to retain the original .aspx Url created in Sitefinity v. 3.7 SP4 in Sitefinity v.4.1 SP3?
Hi Samir Vaidya,
You can either utilize a UrlRewriter such as this one and provide rewrite rules for the old URLs, add additional URLs (which redirect to the default one) to the pages, or change the page.UrlName property.
e.g.
var fluent = App.WorkWith().Pages();
var mypage = fluent.Where(p => p.Page !=
null
&&p.Parent==
"Pages"
).ForEach(p => p.Page.UrlName = p.Page.UrlName+
".aspx"
).SaveChanges();
Where do I utilize this code in the context of Sitefinity? Do I create a separate User Control for handling this and add it to the Page or do something else with changing the Page properties?
Hello Samir Vaidya,
You can place it on a WebForm included in that project and simply navigate to it from the browser, the code will automatically execute.
Greetings,
Boyan Barnev
the Telerik team