November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
If you do not check the checkbox "Create a subfolder for each Virtual Path Provider" in the migration tool then your resources will get a path like: /globalassets/*.
Then you can register a new route with a different name than "globalassets" like:
routes.MapAssetRoutes(
name: "CustomMedia",
url: MediaStaticSegmentPlaceHolder + "/{node}/{partial}/{action}",
defaults: new { action = "index" },
staticSegmentPlaceHolder: RouteCollectionExtensions.MediaStaticSegmentPlaceHolder,
globalReplacement: "Global",
siteReplacement: RouteCollectionExtensions.SiteAssetStaticSegment);
you need to add your route before the default one, e.g. in an event handler to Global.RoutesRegistrating.
Then optionally (for performance reasons it is unnessecary to have extra routes) you can remove the original ContentRoute named "Media". This can be done e.g. in an event handler to Global.RoutesRegistered.
When I didn't check that box it put all the files in one main folder and the whole structure we had in CMS 7 (including block folders) were gone
Yes, if you do not check in the check box the vpp structure will be merged in to the existing structure (It should not delete the old structure).
Is the problem that you really want the url to look like /Global/* or that you want old urls (like e.g. in bookmarks) like /Global/* to still work? If the latter is the case then you could set up a simple redirect rule in IIS from /Global/* to /globalassets/Global/*.
I would rather if /globalassets/ weren't added to the beginning of the URL. But if there is no way to remove that I will have to put a redirect as you say.
As I said above you can change "globalasset" to something else like "Global". But if you then check the checkbox in migration tool you will get urls like "Global/Global/*" which I guess is not what you are after...
When I think of it, you could probably do as I said above to register an own route but instead register it as:
routes.MapAssetRoutes(
name: "CustomMedia",
url: "/{node}/{partial}/{action}",
defaults: new { action = "index" });
Then it should not add "globalassets" before in the url. However you will get a bit of a perfromance penalty since it cant decide immediately if the route matches or not (like it can with a static segment in the beginning).
I put the following code in Global.asax
routes.MapAssetRoutes( name: "CustomMedia", url: RouteCollectionExtensions.MediaStaticSegmentPlaceHolder + "/{node}/{partial}/{action}", defaults: new { action = "index" }, staticSegmentPlaceHolder: RouteCollectionExtensions.MediaStaticSegmentPlaceHolder, globalReplacement: "Global", siteReplacement: RouteCollectionExtensions.SiteAssetStaticSegment);
but it still adds the globalassets to the beginning of asset urls :(
Ok thanks. Sorry I missed the line which you mentioned that. Do I need to do anything else in order to serve the content? At the moment I have URLs like /Global/something/something/image.png but I am getting 404 .
The problem is that this has caused issues with the home page. The home page loads the first time but when I refresh I get 404.
2014-11-07 12:47:39,647 [43] ERROR EPiServer.Global: 1.2.5 Unhandled exception in ASP.NETSystem.Web.HttpException (0x80004005): Not Found at EPiServer.Web.Routing.MultiplexingRouteHandler.GetPageRouteHandler(Object routedData, String path, String language, Boolean return404) at EPiServer.Web.Routing.MultiplexingRouteHandler.GetRouteHandlerOrRedirect(RequestContext requestContext, Object routedData, Boolean throw404IfNotFound) at EPiServer.Web.Routing.MultiplexingRouteHandler.GetRouteHandler(RequestContext requestContext) at EPiServer.Web.Routing.MultiplexingRouteHandler.GetHttpHandler(RequestContext requestContext) at System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) at System.Web.Routing.UrlRoutingModule.OnApplicationPostResolveRequestCache(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
I see, the problem is that your new route now takes care of the request http://site.com/ since the route will get a request to route path "/" which it will do and return GlobalAssetRoot, and hence that is a folder without a template will the routehandler return a 404..
You need to get your route registered in the same place as the ordinary media router. You could have some code like:
protected override void RegisterRoutes(System.Web.Routing.RouteCollection routes) { base.RegisterRoutes(routes); //get index for original media route var mediaRouterIndex = GetIndexForRoute("Media", routes); //register new route, will be added last routes.MapAssetRoutes( name: "CustomMedia", url: "/{node}/{partial}/{action}", defaults: new { action = "index" }); var newRoute = GetIndexForRoute("CustomMedia", routes); //remove route from last in list RouteTable.Routes.Remove(newRoute); //insert before existing media route RouteTable.Routes.Insert(mediaRouterIndex , newRoute); } static int GetIndexForRoute(string name, RouteCollection routes) { for (int i = 0; i < routes; i++) { var contentRoute = routes[i] as ContentRoute; if (contentRoute != null && contentRoute.Name.Equals(name)) { return i; } } return -1; }
Unfortunately that didn't work either. when I remove Media route then another route kicks in and add something else in the beginning such as siteassets or syssite .
Hi all,
I have migrated to CMS 7.5 and used VPP migration tool to migrate files. Now. I can see that file URLs have /globalassts/ at the begining. Does anybody know how I can change this and instead of serving files via /globalassets/Global/* serve files via /Global/* ?