November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hi
The reason id parameter is left is that the plan is to remove the "classic" format (the one with id queryparameter). Then you as partner can use the id parameter for your own purposes. Therefore we didn't want to expose the method to convert from classic format on urlresolver (since the plan is to remove it).
So what you can do now is to have an own method like below (the above code is similar as an internal method on urlresolver)
/// <summary> /// Converts from a link with a classic (/template.aspx?id=123) format to a friendly URL. /// </summary> /// <param name="classicUrl">The permanent URL.</param> /// <returns>A URL in string representation.</returns> internal virtual string ConvertClassicToContentUrl(string classicUrl) { var publicUrl = UrlResolver.Current.GetUrl(classicUrl); if (!String.IsNullOrEmpty(publicUrl)) { //remove "known" query parameters var builder = new UrlBuilder(publicUrl); builder.QueryCollection.Remove("id"); builder.QueryCollection.Remove("epslanguage"); return (string)builder; } return classicUrl; }
Hello,
When the property URL is used to link to a "Page" (i.e. not external URL), the value of that URL property becomes something like {/link/4320a14625af4d7c84633d85d88e8e7c.aspx?id=1234}.
In an MVC view, I can use Url.ContentUrl to resolve this URL to a nice friendly URL (/en/my-page/).
But in some cases I need to resolve the URL in a Controller, so I use UrlResolver.Current.GetUrl. Howerver, the resulting friendly url still has the internal ID appended as a querystring (the internal URL above would get resolved to /en/my-page/?id=1234).
How do I resolve the Url property in a controller without getting the internal ID querystring?
/John