asp.net mvc 4 - mvc4 areas multiple route -
i have web site in mvc4 area "admin" inside controller named "homecontroller" ,also in project folder controller controller named "homecontroller" : when call
public actionresult logoff() { formsauthentication.signout(); return redirecttoaction("index", "home"); } i error : multiple types found match controller named 'home'. can happen if route services request ('{controller}/{action}/{id}') not specify namespaces search controller matches request. if case, register route calling overload of 'maproute' method takes 'namespaces' parameter.
the request 'home' has found following matching controllers: site1.co.il.controllers.homecontroller site1.co.il.areas.admin.controllers.homecontroller
if have same controller , action in different areas, mvc4 has no way choose 1 of them, unless specify desired route.
you can specify this:
return redirecttoaction("action", "controller", new { area = "area" });
in case area should "admin"
if want refer root controller, area should ""
you can try refer appropriate controller this: "admin\home", don't know if equivalent "\home" work.
Comments
Post a Comment