I have the following project structure. Where I have two controllers at home and an account, one of them is in the test zone, and the other is in the route level project. Now after entering from the area I want to redirect the Home Index area But it redirects me to the initial level of the route.

MapRoute Test Zone Registration
public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Test_default", "Test/{controller}/{action}/{id}", new { controller = "Account", action = "Login", id = UrlParameter.Optional }, namespaces: new[] { "MVCAreaSample.Areas.Test.Controllers" } ); }
Basic level maproute
routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }, namespaces: new[] { "MVCAreaSample.Controllers" } );
Area Redirection Action Method
[HttpPost] public ActionResult Login(TestModel test) { var candidateContext = "LoginContext"; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(2, candidateContext, DateTime.Now, DateTime.Now.AddMinutes(60), true, "Manjay"); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); //Check required for code contracts. if (System.Web.HttpContext.Current != null) { System.Web.HttpContext.Current.Response.Cookies.Add(authCookie); if (System.Web.HttpContext.Current.Session != null) System.Web.HttpContext.Current.Session["LoginContext"] = candidateContext; } return RedirectToAction("Index", "Home"); }
I tried to specify the name of the area in the route. It works in this case. But suppose I have the correct authentication logic at both levels except incase
RedirectToAction ("Index", "Home", new {area = "Test"});
This will give me a basic level login page.