Is it possible to define the URL segment for an action on a PageController<T>
?
Take for example the following controller,
public class MyPageController : PageController<MyPageData>
{
public ActionResult Index(MyPageData currentPage)
{
return View(currentPage);
}
[HttpPost]
public ActionResult SubmitForm(MyPageData currentPage, FormModel model)
{
// ...
return Redirect("/");
}
}
New, let's say we've created an instance of MyPageData
at the URL /my-page
, if we render a form who's action is the SubmitForm
action, we'll get a URL like so <form action="/my-page/SubmitForm">
@using(Html.BeginForm("SubmitForm"))
{
...
}
My question is, is there any way to define or control how the URL segment for the non-Index action is rendered, so the form would render like so <form action="/my-page/submit-form">
?
You should be able to use the standard ASP.NET action name attribute, such as