Monday, May 15, 2017

Convert Permanent Link for Image to Virtual PRANK

Hello there
Does anyone know how to change a Permanent Link such as “~/link/e76463a4b3604b51952312ca0e404bcd.gif” into a virtual link such as “/Global/images/myimage.jpg”?
There’s a tool to do it for Pages but I haven’t found anything for images.
This is what I’ve tried so far but I keep getting the permanent link or nothing at all:

            string mappedLink = item.ToMappedLink();
            string permanentLink = item.ToPermanentLink();
            var url = new UrlBuilder(item.Href);
            bool result = PermanentLinkMapStore.ToMapped(url);
            string test = result ? url.ToString() : item.Href;
            string str;
            PermanentLinkMapStore.TryToMapped(uriToImage, out str);
 This works in my CMS 6 installation:
string permanentLink = "~/link/9abeeb4114cd4c129187aa2562eaa849.jpg";
UrlBuilder url = new UrlBuilder(permanentLink);

PermanentLinkMapStore.ToMapped(url);

lblTest.Text = url.ToString();
http://world.episerver.com/forum/developer-forum/Developer-to-developer/Thread-Container/2010/5/Convert-Permanent-Link-for-Image-to-Virtual/

No comments:

China US AI URGENT meeting adversial attack ( Alibaba site commercial attack )

 https://www.abc.net.au/news/2026-05-12/trump-xi-beijing-summit-must-confront-ai-cold-war/106666482 https://www.thewirechina.com/2026/03/29/...