asp.net mvc routing - MVC5 with multiple parameters -


i doing in registerroutes method in mvc5 application:

    public static void registerroutes(routecollection routes)     {         routes.ignoreroute("{resource}.axd/{*pathinfo}");          routes.maproute(             name: "default",             url: "{controller}/{action}/{id}",             defaults: new { controller = "home", action = "index", id = urlparameter.optional }         );          routes.maproute(         "maestro",         "{controller}/{action}/{clienteid}/{sku}",         new { area = "servicio", controller = "maestro", action = "obtiene", clienteid = "", sku = "" });     } 

but when try load url: http://localhost:1680/servicio/maestro/obtiene/1/et-fg930ctegww

a 404 error shown.

on other hand, controller method implementation:

public class maestrocontroller : controller {     //     // get: /servicio/maestro/obtiene/clienteid/sku     public jsonresult obtiene(int clienteid, string sku)     {         using (dashboard.models.dashboardrfidentities db = new models.dashboardrfidentities())         {             var maestro = db.maestro                 .where(m => m.clienteid == clienteid && m.maestrosku == sku)                 .select(m => new { clienteid = m.clienteid, codigobarra = m.maestrocodigobarra, sku = m.maestrosku, descripcion = m.maestrodescripcion, linea = m.familia.linea.lineanombre, familia = m.familia.familianombre, ultimocorrelativo = m.maestroultimocorrelativo })                 .firstordefault();             return json(maestro, jsonrequestbehavior.allowget);         }     } } 

is there proper way accomplish without using url parameters separated "&"?

regards jaime


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -