c# - MVC Routing picking up Area controllers at root -
I am getting difficulties with my controllers who are responding to requests on the routes in an area which Are not there. So I have such a setup (extra luggage cut):
/ Ares / security / controllers / member controller CAS / AREES / security / securityArgation.cs / controller / home controller CS I have my area of security:
Namesplace MyApp.Web.Areas.Security {public class securityArera registration: regional registration {public override string areaname { Receive {and Püssi "security"; }} Public override blank register area (Regional Registration Content Reference) {reference.MapRoute ("security_default", "security / {controller}" {{action} / {id} ", new {action =" index ", id = UrlParameter Optional}); }}} and my global routing rules:
route. Ignoreroute ("{resource} .axd / {* pathInfo}"); way. Unknown route ("{* robotstxt}", new {robotstxt = @ "(. * /)? Robots.txt (/.*)?"}); way. Unknown route ("{* favicon}", new {favicon = @ "(. * /)? Favicon.ico (/.*)?"}); Routes: "default", url: "{controller} / {action} / {id}", default: new {controller = "home", action = "index", id = UrlParameter.Optional}, namespace: new string [ ] {"MyApp.Web.Controllers"}); I am doing a lot in my global ASX but the relevant part is that I regional registration. Caller All Aries (); I call the routing function which states above. But my problem is that the request for "member /" is killing my member controller using my "default" route ... even if the name of the controller is not specified. If he tries to walk then he can not be seen because he is defined in the field and is trying to find him in the entire visual folders. I tried to create a texture of the root namespace "weird names ..no.content" and it still hits the member controller - I can not find any way to use this controller How do I request this which are not in its area?
By looking for a solution that ends in the end:
routes. MapRoute (name: "default", url: "{controller} / {action} / {id}", default: new {controller = "home", action = "index", id = UrlParameter.Optional}, namespace: new String [] {"MyApp.Web.Controllers"}) .dataCons ["usernamenamepuzzlebackback"] = false; For any reason not set, it does not always matter to me finding my controllers where they were and completely ignore my namespace - from other referenced assemblies as well. Looking through KLST, DefaultControllerFactory looks like GetControllerType eventually gets back by searching every controller if it does not find the controller in the namespaces you asked. . This flag is being set automatically on the routes made in a specific area, but people whom I made on the global level when I set it on to the global people, they behave Start was that I was hoping to how original. I do not know why you want to turn it on ...
Comments
Post a Comment