我想在MVC3中更改URL

时间:2013-05-09 10:35:53

标签: asp.net-mvc-3 routing urlrewriting.net

我有

http://localhost:4660/Grid/IndexWithAjax?ajax=this%20is%20ajax%20sample

点击

  

@ Html.ActionLink(“Ajax2”,“IndexWithAjax”,“Grid”,new {ajax =“这是   ajax示例“},null)

但我想更改此网址,例如

http://localhost:4660/Grid/IndexWithAjax/this%20is%20ajax%20sample

请帮助我如何做到这一点,我也在全局文件路径中做了如下所示。

routes.MapRoute(
             "GridData2", // Route name
             "{controller}/{action}/{ajax}", // URL with parameters
             new { controller = "Grid", action = "IndexWithAjax", ajax = UrlParameter.Optional } // Parameter defaults
         );

0 个答案:

没有答案