Is it possible to have a action method with a name that is different to the action name specified in the url? I tried doing this with the routes table in Global.asax with no luck. Here's what I tried:
routes.MapRoute(
"ApproveSellers",
"Admin/Account/ApproveSellers/",
new { controller = "Account", action = "ApproveSeller"},
new[] { "UI.Areas.Admin.Controllers" }
);
I want the action method to be called ApproveSeller but the url to be ApproveSellers.
You need to do it using action attribute. In the route, you just define the default value.
Here is in the controller:
public class AccountController
[ActionName("ApproveSellers")]
public ActionResult ApproveSeller
{
...
There is an attribute for that:
[ActionName("NewName")]
public ActionResult OldName()
{
return View();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With