The problem is caused by the fact, that your two routes "Math" and "Default" are defining different named parameters When you call:
localhost:18118/Calculator/Add/Hallo
Then the "Default" route is used and named parameters are:
- controller = calculator
- action = Add
- id = Hallo
But your Action Add
requires parameter named foo
. I would suggest, rename the foo parameter in the "Math" route mapping as id:
routes.MapRoute( _
"Math", _
"Calculator/{action}/{id}/{intBar}", _ ' foo renamed to id
New With {.controller = "Calculator", .action = "Add", .id = ""} _
)
And rename the Action parameter as well: Function Add(ByVal id As String,...
to make it working.
NOTE: renaming is suggestion to make it working, not saying that this is the best way how to do that...