asp.net mvc - Routes not found or constructed incorrectly -


the following routes definition global.asax.cs:

routes.add(   new namedtypedroute(     "feedback-en", routetype.regular, "{culture}/feedback",     new routevaluedictionary(       new       {         culture = "en",         controller = "feedback",         action = "index"       }     ),     null,     new multilingualmvcroutehandler()   ) );  routes.add(   new namedtypedroute(     "feedback-sl", routetype.regular, "{culture}/kontakt",     new routevaluedictionary(       new       {         culture = "sl",         controller = "feedback",         action = "index"       }     ),     null,     new multilingualmvcroutehandler()   ) ); 

if in view

<%: html.actionlink("sl", "feedback-sl")%> | <%: html.actionlink("en", "feedback-en")%> 

the constructed url points root site (no controller/action information included in constructed link).

if in view

<%: html.routelink("sl", "feedback-sl")%> | <%: html.routelink("en", "feedback-en")%> 

an exception occurs:

"a route named 'feedback-sl' not found in route collection. parameter name: name" 

my 2 questions:

  1. why there 2 similar helpers, routelink , actionlink? what's difference between them?
  2. i guess there wrong namedtypedroute implementation. need have named routes , typed routes - route can admin , regular. use information dynamically construct administration menu based on routes definition. administration pages, have names pointing resource strings , use names in administration page titles. way have localizable route names. overcomplicating ??

html.actionlink extension renders anchor element links action. html.routelink extension on other hand renders anchor element resolve action method, file, folder, or other resource. routelink doesn't take actionname , controllername strings actionlink. more detail bit @ parameter names parameters. descriptions here not written in msdn/intellisense.

sadly don't have answer second question.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -