How do I force the friendly URL conversion?


I know there is some process which rewrites all the HREFs in content to the friendly URL.  So, at some point in the page lifecycle, internal links go from...




Where does this process happen, and can it be forced?  I have some content that (for a very odd, but domain-specific reason) I am generating as a string in in a handler (.ashx).  So, this content is not going through this "filter," and the links aren't being converted.

Is there some way to force this link conversion?  On a raw string, preferably?

Apr 16, 2010 17:08


I think you should be able to use your FriendlyUrlRewriteProvider. With that you can use the ConvertToInternal / ConvertToExternal (The default provider is in the EPiServer.Web namespace)


FriendlyUrlRewriteProvider provider = new FriendlyUrlRewriteProvider();
                provider.ConvertToInternal(new UrlBuilder(theUrl));

FriendlyUrlRewriteProvider provider = new FriendlyUrlRewriteProvider();

provider.ConvertToInternal(new UrlBuilder(theUrl));




Warning though.. I haven't used these myself so I might be way off. But looks like that is the way. Mayeb I have time to look at it mor later if im wrong.

Apr 16, 2010 17:43

Thanks, Johan, but I don't really want to feed it individual links.  I'd rather give it a big string and have it find the links and correct them all, like it must do at some point in the page lifecycle.

Apr 16, 2010 21:01
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.