开发者

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

开发者 https://www.devze.com 2022-12-30 06:12 出处:网络
I have the following action. I can hit this with /basket/address?addressId=123 However i wonder how i can hit it with

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

精彩评论

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