Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
I'm not sure this is the correct way to handle this problem, and the solution is from a EPi 6 project. We created created a new URL-rewriter (might work to attach to an event instead, but we had some other functionality the needed a own rewriter), and in that rewriter we did:
protected override bool ConvertToExternalInternal(EPiServer.UrlBuilder url, object internalObject, System.Text.Encoding toEncoding)
{
if (!PageReference.IsNullOrEmpty(internalObject as PageReference))
{
var page = DataFactory.Instance.GetPage((PageReference)internalObject);
if (page != null && page.LinkType == PageShortcutType.Normal && page["PageExternalURL"] != null)
{
url.Path = "/" + page["PageExternalURL"];
url.QueryCollection.Remove("id");
url.QueryCollection.Remove("epslanguage");
return true;
}
}
return base.ConvertToExternalInternal(url, internalObject, toEncoding);
}
The above solution Erik suggests will work for WebForms but not for MVC (since MVC responoses does not pass through the FURL parsing). Another alternative is to attach an eventHandler to EPiServer.Web.Routing.ContentRoute.VirtualPathCreated. In the eventhandler you could load the content item and see if it has an simple address and if so replace the Url in the event argument (similar to the code above).
I am a bit baffled on how to accomplish this. We have successfully converted their site awhile back from Drupal to EPiServer 7. Pre (EPiserver 7.5). They are abit annoyed that when they specify a short url, that is not the link the user is presented with as the link. Yes, it response to the short url but they want the short url to be the url users see. Any help would be appreciated.