Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes
Accepted

Sitecore MVC Routing and Virtual Folders

What I ended up doing is registering a single route on pipelines/initialize: <pipelines> <initialize> <processor type="MyFramework.Routing.RegisterVirtualFoldersRoutes, ...
vandsh's user avatar
  • 1,651
8 votes
Accepted

InvalidOperationException: No route in the route table matches the supplied values

Methods like @Html.Action(), @Html.RenderAction etc. apparently requires a route with the {controller}/{action} pattern (even though it isn't actually relevant from what I can see). The config file ...
Søren Kruse's user avatar
  • 3,245
7 votes

Passing a parameter to controller rendering through URL

I've done this before using a wildcard item for the parameter and a custom resolver processor that runs just after the ItemResolver - The ItemResolver should resolve to /sitecore/content/mysite/...
Richard Seal's user avatar
  • 20.5k
6 votes
Accepted

Passing a parameter to controller rendering through URL

Rather than an item named product, create an item named products that represents the entire collection, and then create a child item named * to represent any individual product. Wildcard items will ...
zzzzBov's user avatar
  • 873
5 votes
Accepted

Troubleshooting Sitecore Identity Server routing errors in Sitecore 9

SitecoreIdentityServer in the URL /identity/login/shell/SitecoreIdentityServer is just an identity provider name which is configured in Sitecore.Owin.Authentication.IdentityServer.config. It should be ...
Gobinath Saminathan's user avatar
5 votes
Accepted

How to pass dynamic parameters to a Sitecore page via the URI?

You can use Sitecore Wildcard item. For that, create an item with name of * inside /Home/Statistics item (/sitecore/content/Home/statistics/*). Remember, the * item (wildcard item) should not have any ...
Yogesh Patel's user avatar
  • 1,007
4 votes

EntityService-based controllers stop working when adding a controller with a named route

This will be the way the routes get registered when applied by attributes. The correct way to register your own routes with Sitecore is to write a custom initialize pipeline processor and patch it in ...
Richard Seal's user avatar
  • 20.5k
4 votes
Accepted

Html.Sitecore().Controller on a CD - No route in the route table matches the supplied values

As stated in the SO answer, the real issue is that without enabling the Sitecore.Speak.MVC.config, there's no route pattern matching just {controller}/{action}. The answer that will solve your ...
Pete Navarra's user avatar
  • 14.7k
3 votes

A route named x is already in the route collection. Route names must be unique

This issue is solved. For me this issue was only happening for Sitecore 8.2 on a machine with ASP.NET version 4.6 and above. Also issue surfaces when I launched EXM Dashboard or Experience Analytics ...
Himadri Chakrabarti's user avatar
3 votes
Accepted

Sitecore WebApi custom route not working controller not found

Your route pipeline definition should be changed to this one: public class RegisterTestApiRoute { public virtual void Process(PipelineArgs args) { RouteTable.Routes.MapRoute( ...
Peter Procházka's user avatar
3 votes
Accepted

JSS LayoutService decoupled from Routing in Angular

Absolutely possible to use without routing. The layout service is a simple REST API at its core, and it does not care if it's invoked from a router or not. The sample app's jss-context.service.ts ...
Kam Figy's user avatar
  • 4,143
3 votes

Passing a parameter to controller rendering through URL

How about using just a wildcard? Assuming all instances of /product/xxx use the same layout, you'd create a single subpage under it called * and set the renderigns on that item. Then in your ...
Derek Dysart's user avatar
  • 2,489
3 votes

Passing a parameter to controller rendering through URL

Longhorn I've handled this by doing a url re-write in IIS to convert your request for a SEO Friendly url to a parameter based one like so: <rule name="Friendly Product Urls"> <match url="...
Adam Seabridge's user avatar
3 votes

Error when using custom routes with https: "Attempt to retrieve context object of type 'Sitecore.Mvc.Presentation.RenderingContext' from empty stack."

The code looks like it should work. I would make the following changes to just make things a bit more robust: Add a [HttpGet] attribute to the Login action result. It could be that over https the ...
Richard Seal's user avatar
  • 20.5k
3 votes

How do I remove /sitecore from API calls?

With WebAPI you may define your custom controller routes using Route attribute. The controller below excludes the /sitecore prefix from the URL and accessible as <hostname>/api/my: [RoutePrefix(...
Serhii Shushliapin's user avatar
2 votes

How do I remove /sitecore from API calls?

As I see it, your options are: Change the routing setup to remove the /sitecore part from the expected route information. Not knowing your code, this could have side effects and would need a thorough ...
Richard Seal's user avatar
  • 20.5k
2 votes

How to have a custom url for a listing page

I have implemented something similar to this using the wildcard solution. I had a begin request pipeline that fired when an item of a specific type was being hit (the type that my wildcard was). The ...
Teeknow's user avatar
  • 2,477
2 votes
Accepted

Requested document not found when using MVC routes

The code below is code I reuse constantly. The only caveat is that is the controller is in a different project/library than the route initialization code, strange thing happen. I always keep the ...
Chris Auer's user avatar
  • 13.1k
2 votes

A route named x is already in the route collection. Route names must be unique

Another solution and basically the simplest one is to remove dlls that add custom routes. You need to identify them and remove from your bin folder. You can try to add some suffix to the end of the ...
Peter Procházka's user avatar
2 votes

Sitecore custom api routing is not working

It needs to create custom routing for calling a controller action method for multisite. Steps are as below: Step 1) Add App_start folder in the Foundation Layer Project. Add a class file in this ...
Ratnesh Pandey's user avatar
1 vote

Custom MVC Routing in Sitecore does not read Sitecore context language

The code you provided seems to be setting the scLanguage route parameter based on a hardcoded value ("ab-AB" or "de-DE") depending on the Sitecore.Context.Language.Name property. ...
Sreekrishnan's user avatar
1 vote

HTTP 500 errors when accessing custom route which can't find a controller

You can: Create custom Contoller Factory overriding SitecoreControllerFactory class. Register custom factory in Sitecore ( https://doc.sitecore.com/xp/en/developers/103/sitecore-experience-manager/...
Marek Musielak's user avatar
  • 23.8k
1 vote
Accepted

{virtualFolder} in route config is not taking full path defined on the site defnition file

You need to define separate routes for entries like that: routes.MapRoute( name: "routeNameVirtualFolder", url: "{virtualFolder}/api/ContrrolerName/ActionName", ...
Marek Musielak's user avatar
  • 23.8k
1 vote
Accepted

Redirect URL A to URL B

As an alternative you can write your own processor. For example like you would create a 404 processor, but then let it hook into a Sitecore list where you map url's to external links. Like: public ...
Joost's user avatar
  • 505
1 vote

ServiceApiController Method not found when using HttpPost and ComplexType (Sitecore 8.1.3)

It looks like you need to use the JSON.stringify() to pass an object. jQuery.ajax({ type: 'Post', contentType: 'application/json', data: JSON.stringify({ "firstName" : "first", "lastName" : "...
Andrey Bobrov's user avatar
1 vote

I need to integrate a controller from a compiled dll into a controller I can build/control. How can I call that as a rendering?

If I'm understanding correctly, you're looking to get the result from a controller, and return that through an API controller. The problem with that is that a controller action generally returns an ...
Matthew FitzGerald-Chamberlain's user avatar
1 vote
Accepted

Redirect requests based on missing data on wildcard item

The reason why you are seeing an empty page (with header and footer) when requesting a faulty id is probably because the code in the rendering that shows your actual content can't find any data and ...
Gatogordo's user avatar
  • 20.1k
1 vote

Redirect requests based on missing data on wildcard item

You will need to have a custom processor in the <httpRequestBegin> which see if the item in the url is valid or not. So, the patch will be as follows: <configuration xmlns:patch="http://www....
Hishaam Namooya's user avatar
1 vote
Accepted

wo url serving default.aspx

I think Sitecore (the .net framework underneath actually) is detecting your "wo" as a language (Wolof - Senegal). There is a setting in Sitecore called Languages.AlwaysStripLanguage. If you would ...
Gatogordo's user avatar
  • 20.1k
1 vote

MVC Routing with Language Variant in Sitecore

You could add your language as a parameter to the route. Something like this: routes.MapRoute("FormsApiWithLanguage", "{languageCode}/api/sitecore/Forms/SubmitForm", new { controller = "Forms"...
Richard Seal's user avatar
  • 20.5k

Only top scored, non community-wiki answers of a minimum length are eligible