views:

12

answers:

1

I have the following View structure:

Home
    Index

Security 
    Accounts
          LogOn

The following code in the LogOn action causes a redirect to http://localhost/Security/Home/Index instead of http://localhost/Home/Index

return RedirectToAction("Index", "Home");

Here is my Route registration code for each:

Home

   routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new {controller = "Home", action = "Index", id = UrlParameter.Optional} // Parameter defaults
                );

Security

public override void RegisterArea(System.Web.Mvc.AreaRegistrationContext context) {
            context.MapRoute(
                    "Security_default",
                    "Security/{controller}/{action}",
                    new { action = "LogOn" }
                );
        }

Any help greatly appreciated.

+2  A: 

Try redirecting to the empty string area:

return RedirectToAction("Index", "Home", new { area = "" });
Tyler Jensen
Works great! Thanks.
sydneyos