Ho un controller chiamato account con un azione con la seguente firma:Errore MVC Percorso: La voce 'Lunghezza' vincolo
public ActionResult Verify(string userName, Guid authorisationToken);
ho creato un link per chiamare questa azione così:
/Account/Verify/sachin13/409bdaaa-0b65-4bb8-8695-6e430323d8f8
Quando vado a questo link ricevo il seguente errore:
The constraint entry 'Length' on the route with URL 'Account/{Verify}/{userName}/{authorisationToken}' must have a string value or be of a type which implements IRouteConstraint.
questo è ciò che il mio metodo RegisterRoutes sembra li ke in Global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } ,// Parameter defaults
new[] { "UI.Controllers" }
);
routes.MapRoute(
"AccountVerify",
"Account/{Verify}/{userName}/{authorisationToken}",
new { controller = "Account", action = "Verify", userName = "", authorisationToken = "" },
"UI.Controllers"
);
}
Due domande:
sto facendo nulla di straordinario o è la mia metodologia di qui in linea con la prassi consolidata?
Qual è il problema qui?
Grazie,
Sachin
Sergey, signore - è stato brillante - ha funzionato. Devo che tu sia birra. –