开发者

Category is special word in ASP.NET MVC2? So how can I use something else?

开发者 https://www.devze.com 2023-01-11 17:16 出处:网络
I have just realized that, by chance, I implemented a category browse type situation in my project: // GET: /Category/Brows开发者_Python百科e?Category=Fruit

I have just realized that, by chance, I implemented a category browse type situation in my project:

// GET: /Category/Brows开发者_Python百科e?Category=Fruit
public ActionResult Browse(string category)
{
    ...
}

It turns out this is special case and there must be something behind the scenes. My next one I want to implement something like

//GET: /Category/Browse?Color=Blue
public ActionResult Browse(string color)
{
   ...
}

You get the idea...

Where/how do I register the different url values?


You don't need to register anything. Action parameters are automatically mapped to URL values by the default model binder. You can also map to complex type, list and dictionary parameters.

0

精彩评论

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