In my Account/Login controller method, I have something like:
var classA = GetObject(); //actual code omitted
switch(classA.PropA)
{
case 1:
return RedirectToAction("Action2", "Registration");
//more case code omitted
default:
return RedirectToAction("Index", "Registration");
}
All the cases work fine in the switch block except the default where it's suppose to go to Index in RegistrationController. Instead of that, it takes me to localhost:port/Registration, where the action Index is omitted.
It works fine if the ActionName is changed to something else - Index2 for example. Also works fine if the controller name is changed to something else.
RouteConfig is just the auto-generated code from creating the project, which is as follows:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
Thanks in advance.
RedirectToAction("Index", "Registration");executes?localhost:port/Registration/indexthen?