ASP.NET MVC 2: view subfolders?

It seems to me that when I work with View and Controllers, these controllers process only the first level of their corresponding folder.

/Controllers/MembersController
/Views/Members/

How should the controller handle subfolders?

/Views/Members/Business
+3
source share
3 answers

The controller is not . If you need a page in a URL /Views/Members/Business/ThePage, you will solve this by defining a route in global.asax.cs. If you need to place views in subfolders for your organization, you should consider splitting your controllers.


Refresh in response to your comment.

: , , .

, , MVC . , . ( , - . , - ...) ...

  • -, MVC , , . , , -, , , . ( , , , .)

  • , , , URL. URL- .

  • , " ", , . , - . - , - return View();.

  • ( , ), , . , .

, , , ( 1 2), , ( 3), , t .

, , ( , ViewResult), , , URL-, , . , , url, // .


- , http://www.asp.net/mvc/ . , , .

+5

, :

return View("/Views/Members/Business/Index.aspx", model);
+4

Source: https://habr.com/ru/post/1781546/


All Articles