开发者

how to pass querystring in friendly url in asp.net mvc

I have the following action. I can hit this with

/basket/address?addressId=123

However i wonder how i can hit it with

/basket/address/123

 public ActionResult Address(int addressId)
    {
        return RedirectToAction("Index");
    }

my routes

 routes.MapRoute(
            "Default",                                开发者_运维百科              // Route name
            "{controller}.aspx/{action}/{id}",                      // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults

       );


Change:

public ActionResult Address(int addressId)

to

public ActionResult Address(int id)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜