asp.net - Correct optional route parameters on browsing url -
i working on ecommerce project (asp.net mvc3). routes product , categories mentioned below
routes.maplocalizedroute( "product", "p/{productid}/{sename}", new { controller = "catalog", action = "product", sename = urlparameter.optional }, ); routes.maplocalizedroute( "product", "c/{categoryid}/{sename}", new { controller = "catalog", action = "category", sename = urlparameter.optional }, );
when utilize browse url http://mysite.in/p/123/my-product
redirects right product , same thing happens category well.
now when provide wrong sename or removes sename url redirects right product/category, correct. want valid sename appended i.e if there wrong or no sename in url sename repsective product/category should added in url. there effect on site seo of above functinality.
stackoverflow same think i.e though sename optional appends sename if not provided.
please reply if having worked on same issue.
this referred 'slug' , typically handled in action filter. phil haack has article manipulating action method parameters explains in detail. basic concept handle filters onactionexecuting
method extract route value id
parameter, corresponding name database , add together value name
parameter.
asp.net asp.net-mvc-3 url-routing
No comments:
Post a Comment