November Happy Hour will be moved to Thursday December 5th.

Friendly URL get UnifiedFile

Vote:
 

Hi,

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()?

#53657
Sep 18, 2011 16:35
Vote:
 

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.

#53667
Sep 19, 2011 13:25
Vote:
 

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.

#53671
Sep 19, 2011 15:04
Vote:
 

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.

#53672
Sep 19, 2011 15:25
Vote:
 

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

#53794
Sep 22, 2011 17:48
Vote:
 

Yes, 10 seconds by default

#53812
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.