开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜