Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Friendly URL get UnifiedFile



Will the ConvertToInternal() method also return UnifiedFiles? If it's a page internalObject can be casted to a PageReference.

object internalObject;

if (Global.UrlRewriteProvider.ConvertToInternal(new EPiServer.UrlBuilder(url), out internalObject))
    UnifiedFile file = internalObject as UnifiedFile;

    if (file != null)


Or should I go with the HostingEnvironment.VirtualPathProvider.GetFile()?

Sep 18, 2011 16:35

Just go with HostingEnvironment.VirtualPathProvider.GetFile, the ConvertToInternal only cares about mapping external paths to internal paths - I don't think you can get an UnifiedFile from there.

Sep 19, 2011 13:25

Why is the out parameter of type object, if it only returns page references? Would have been nice with some xml-comments on methods like these.

Sep 19, 2011 15:04

You could argue that it is too abstract but that it is how the URL rewriters are designed. The method will convert whatever you send in and return an hint (the out value) to what internal representation it used, in most cases it is a PageReference but nothing says it must be depending on the provider.

Sep 19, 2011 15:25

Is the result cached after the ConvertToInternal() is called?

Sep 22, 2011 17:48

Yes, 10 seconds by default

Sep 23, 2011 8:46
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.