Controller with same name as an area - Asp.Net MVC4
Posted
by
Trober
on Stack Overflow
See other posts from Stack Overflow
or by Trober
Published on 2013-11-04T21:50:49Z
Indexed on
2013/11/04
21:53 UTC
Read the original article
Hit count: 235
I have a Contacts controller in the main/top area, and I have an area named "Contacts".
I get POST 404s to the Contacts controller if I register my areas before I register my top-level routes:
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
ModelBinders.Binders.DefaultBinder = new NullStringBinder();
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
And, if I register my areas after my routes, my 404s to the Contacts controller goes away, but my routes to the Contacts area are now 404s.
...lots of duplicate controller name questions logged, but I haven't found a specific scenario where the area is the same name as the controller.
...probably an easy fix. Would appreciate help. :-D
© Stack Overflow or respective owner