Hi there,
In many of our web sites I see developers use this method: Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl
I also know that you have been recommending not to call this from custom code as the method depends on context that may or may not be available.
This leads me to the question: should you never use this? Or sparingly knowing the caveats? There are a few scenarios where I think calling this method would be helpful:
1. In building client side AJAX URLs. For example:
@ {
var cartUrl = Dynamicweb.Frontend.SearchEngineFriendlyURLs.GetFriendlyUrl(cartId);
}
...
$.Ajax(@cartUrl, {});
Without the call to GetFriendlyUrl, I would be calling Default.aspx?ID=123 which then server side would redirect to /cart, right? We call stuff like this quite often so having extra redirects on all calls feels like a waste. Hardcoding /cart feels bad too as it means we'll have issues with multi-language sites,
2. Newsletters and other email
For example, when sending a user an email from the Data Integration module we'd like to link to the password reset page. Linking to Default.aspx?ID=456 looks pretty ugly, and I would prefer /my-account/reset-password instead.
How could I accomplish that without GetFriendlyUrls and without hardcoding the page name?
Thanks in advance for any guidance you can give.
Imar