.net - ASP.NET mvc4 friendly url -


i strugling creation of url user , seo friendly. have controller helloworld :

public class helloworldcontroller : controller {     //      // get: /helloworld/       public string index()      {          return "this <b>default</b> action...";      }       //      // get: /helloworld/welcome/       public string welcome(string name, int numtimes = 1)     {         return httputility.htmlencode("hello " + name + ", numtimes is: " + numtimes);     }  } 

action welcome needs parameters passed

localhost:46963/helloworld/welcome?name=marek&numtimes=5

i want ask how possible pass parameters user friendly url example:

localhost:46963/helloworld/welcome/marek/5

. alerady tryed som magic routes nothing working.

thank in advance.

just write route yourself

  routes.maproute(         "default",         "{controller}/{action}/{name}/{id}",         new { controller = "helloworldcontroller", action = "welcome", name = urlparameter.optional,id=urlparameter.optional }     ); 

the params mapped accordingly; these called seo friendly url's

try link http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -