2

There is any way to change the defualt views path in MVC3/4. i.e: The Url http://localhost:000/Home (the controller Home) will represent the view at Views/Style1/Home/Action.

Thanks ahead!

Matan Shahar
  • 3,190
  • 2
  • 20
  • 45

2 Answers2

1

Ok, now that I understand the question better after the edit, I think this is what you're looking for:

You can change the ViewLocation in Application_Start().
The example below assumes use of the Razor View Engine.

ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine { ViewLocationFormats = new string[] { "~/Views/Style1/{1}/{0}.cshtml" } } );

Answer was partially derived and referenced from this post

Community
  • 1
  • 1
DennisG
  • 71
  • 2
0

You should be able to set the Default route for your application to use a different base path. You can typically set the route in the Global.asax in the RegisterRoutes method.

Example:

routes.MapRoute(
                "Default", // Route name
                "Style1/{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
DennisG
  • 71
  • 2