Suppose I:
- Have a route
{controller}/{action}/{id}
in myGlobal.asax
file. - A Controller
Foo
and ActionBar(String id)
returning a view. - A very simple View containing a URL rendered by
@Url.Action("bar", "foo")
- explicitly NOT specifying anid
. - If I browse to
/foo/bar/test
, the view will show the rendered URL as/foo/bar/test
. I would have expected that it should be/foo/bar
as I didn't specify a value forid
.
Why would it include the current id even when I didn't specify it, and is there any way of preventing this (apart from 'hard-coding' the URL directly)?