Subrata Sarkar
Subrata Sarkar

Reputation: 3064

Route pattern matches but desired action Method is not getting called - Orchard 1.7

I have a set of questions each having several tags to it. Each tag is clickable and supposed to filter the questions based on it.

I have a Route for the tag:

new RouteDescriptor
{
     Priority = -29,
     Route = new Route(
     "questions/tagged/{tag}",
     new RouteValueDictionary {
          {"area","xxx.Intrust"},
          {"controller","Question"},
          {"action","DisplayByTag"},
          {"tag", ""}
     },
     new RouteValueDictionary {
          {"tag",@"\w*/*"}
     },
     new RouteValueDictionary{
          {"area","xxx.Intrust"}
     },
     new MvcRouteHandler())
},

A typical Tag url looks like this: http://local.intrustknowsbusiness.com/lendinng/questions/tagged/minimum%20opening%20deposit

But I am always getting 404 error.

I debugged the code, but no Action method in the controller (typically I like to see "DisplayByTag" is being invoked) is called.

What wrong I am doing? My other Routes are working fine and corresponding methods are also getting invoked as they should.

I am completely stuck. Please help!

Upvotes: 2

Views: 362

Answers (1)

Piotr Szmyd
Piotr Szmyd

Reputation: 13366

Checklist:

  • Give your route a higher priority - something greater than 0 (eg. 100)
  • Check if the feature your controller (and implementation of IRouteProvider) is in is enabled

And btw - avoid having whitespaces (encoded as %20) in paths. This can lead to lots of trouble. Better encode those as dashes etc.

Upvotes: 2

Related Questions