我想在我的第一个 MVC 4 项目中添加第二个 MapRoute,我在Global.asax.vb中添加了这段代码
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
routes.MapRoute( _
"Math", _
"Calculator/{action}/{foo}/{intBar}", _
New With {.controller = "Calculator", .action = "Add", .foo = ""} _
)
routes.MapRoute( _
"Default", _
"{controller}/{action}/{id}", _
New With {.controller = "Default", .action = "Index", .id = ""} _
)
这是我的控制器/Controllers/CalculatorController.vb
Function Add( ByVal foo As String,
Optional ByVal intBar? As Integer = 1) As ActionResult
ViewData("Message") = foo & " Welt"
Return View()
End Function
现在我的问题,我做错了什么?
localhost:18118/Calculator/Add/Hallo - 消息只是“Welt”,但“Hallo”在哪里?
localhost:18118/Calculator/Add/Hallo/7 - 错误 404 ?为什么 ?
我希望你能帮助/教我。谢谢你的时间!