November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Bump! Are there any recommendations from Episerver in this matter? Surely there are more sites out there that use asynchronous calls that needs to be working in editmode?
We had the same issue today... What you need to do is force the URL to be the public-facing (non Edit Mode) URL.
Knowing this, you'll find this topic: http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=66580)... which states there is a bug (#91931) that prevents this. This bug was fixed, but is not available until (hopefully) EPiServer 7.5 (see comments in http://world.episerver.com/Articles/Items/EPiServer-7---Patch-3/)
The current workaround is this code, which we put outside of the controller in a static class:
public static string GetPublicUrl(ContentReference contentLink, string language, RouteValueDictionary routeValues = null)
{
RequestContext requestContext = new RequestContext();
requestContext.RouteData = new RouteData();
requestContext.RouteData.DataTokens.Add("contextmode", ContextMode.Default);
if (routeValues == null)
{
routeValues = new RouteValueDictionary();
}
var urlResolver = new UrlResolver();
var contextSaved = HttpContext.Current;
HttpContext.Current = null;
var url = urlResolver.GetVirtualPath(contentLink, language, routeValues, requestContext).GetUrl();
HttpContext.Current = contextSaved;
return url;
}
All our asynchronous calls like searchbox-autocomplete, menu expansion etc are broken when triggered from inside edit mode, since the URL is changed.
For instance, a normal call to the asynch submenu:
http://localhost/SomePage/Submenu/?22
Will transform into this, when triggered in edit mode:
http://localhost/EPiServer/CMS/Content/SomePage,,168_520/Submenu/?id=168_520&epieditmode=true?22
This request ends with a 404 and a sad face...
We're using MVC (love it!!!) and wondering if there may be some magic routing config that can help us handle these scenarios?