Hi there,
Will keep this as simple a possible:-
I have a have a controller which will return either ViewA or ViewB - e.g.
[HttpPost]
public ActionResult ViewA(BlahModel model)
{
if (isTrue)
return View(model);
else
return View("ViewB", model);
}
...
The problem I have is that ViewB has a form on it. And what happens is that if it gets returned, the action attribute of the tag still points to ViewA.
/MyControllerName/ViewA
I thought I could do something like this:
using (Html.BeginForm("ViewB","MyControllerName"))
But this returns the following URL in the markup:
/ViewB?action=ViewB&controller=MyControllerName
How can I get the HTML Helper to correctly return the following?
/MyControllerName/ViewB
Many thanks
UPDATE
This was indeed caused by some ugly legacy routing from when the project was half-way between WebForms and MVC