【发布时间】:2009-01-09 05:41:26
【问题描述】:
我知道这可能很明显,但我不明白为什么我不能像 int 那样将字符串参数传递给控制器。
例如
//controller/action/2
public ActionResult Action(int someInt)
{
//somenumber != null
}
但是当我像这样传递一个字符串时......
//controller/Action/x9294kskw
public ActionResult Action(string someString)
{
//someString = null
}
我错过了什么?我猜这与路由有关,但是……我不知道。 谢谢!
编辑:
也许我读了 scott gu 的博客有点太粗心了,但这是否记录在某个地方?我应该检查路线!
字符串与整数的处理方式不同是否有特定原因?
【问题讨论】:
标签: c# asp.net-mvc asp.net-mvc-routing