c# - ASP.NET MVC Custom Routing in Sub Folder -


i have searched on google (may wrong keyword) , visited tutorials of asp.net/mvc website. didn't understand routing of mvc properly. have scenario of following figure. want display index.cshtml when website lunched.

enter image description here

i have changed registerroutes method of global.asax.cs file in various ways. latest code (not working) below

routes.maproute(             "app", // route name             "app/{controller}/{action}/{id}", // url parameters             new { controller = "home", action = "index", id = urlparameter.optional } // parameter defaults         ); 

i happy if explains maproute method different example along answering problem.

i don't think problem routes, believe caused moving view , controller folders app folder.

mvc use "convention on configuration" stuff folders located, i'm guessing can't find views/controllers in new folders?

from here:

these folders included in empty asp.net mvc application because asp.net mvc framework default uses “convention on configuration” approach , makes default assumptions based on folder naming conventions. instance, controllers views in views folder default without having explicitly specify in code. sticking default conventions reduces amount of code need write, , can make easier other developers understand project.

i'm not saying it's not possible have folder structure have, dont believe supported out of box. i'd recommend moving default, if need keep structure think may need implement own controllerfactory , viewengine (i'm not sure if these correct hooks need change).

edit: trying implement app area?

edit2: if trying add app area there steps need follow, reason wasn't sure if trying because thought areas had exist within areas folder. there steps outlines here including how register area if trying do.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -