Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalidRouteException on MVC3 application with multiple areas
    primarykey
    data
    text
    <p>I have a MVC3 web application with one default area and one admin area. Both have their won home pages after logging in. After successfully logging in to the application if i try to access the admin area i am getting InvalidRouteException. </p> <p>Scenario is like that i login to the application successfully. When i try to access the admin area using </p> <p><code>http://localhost/admin</code></p> <p>i get following exception.</p> <blockquote> <h2>Server Error in '/' Application.</h2> <p>{controller}/{action}/{id} { controller: 'admin'; action: 'LogOn' } Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. </p> <p>Exception Details: LoginSystem.Web.Exceptions.InvalidRouteException: {controller}/{action}/{id} { controller: 'admin'; action: 'LogOn' }</p> </blockquote> <p>However if i log-out and then use URL like </p> <pre><code>http://localhost/admin </code></pre> <p>it takes me to the login page successfully.</p> <p>Please suggest.</p> <p>Below is my RegisterArea function for the consumer area. </p> <pre><code>public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Consumer_default", "Consumer/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new[] { "MyPortal.Web.Areas.Consumer.Controllers" } ); context.MapRoute( "Admin", // Route name "Admin/{action}/{id}", // URL with parameters new { controller = "Admin", action = "Index", id = UrlParameter.Optional }, new[] { "MyPortal.Web.Controllers" }// Parameter defaults ); } </code></pre> <p><strong>More Information - Update 1</strong> After registering "Admin" Route i am able to move to the Logon page. My application has 2 areas Client and ADmin(this is default one.) Both areas are authenticated. Now the scenario is that i logged in to client module. While i am logged in, i did </p> <pre><code>http://localhost/admin </code></pre> <p>and reached the Logon page. But the issue is that now the url donot contain the Return URL. What should i do so that it contains returnurl. </p> <p>In normal scenario when we are not logged in the Logon page opens with return url added to its url.</p> <p>Please suggest.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload