简体   繁体   中英

How to determine which view is being returned

I have a controller ( AccountController.cs ) whose final statement of its Index method is return View(model); .

In global.asax the only route I can see which relates to this is:

routes.MapRoute("AccountIndex", "Account/Index", new {controller = "Account", action = "Index"});

There is a Views folder, but it appears to only contain partial views and a master. When I right-click and select "Go To View" I get a "Cannot find view" message, although it seems to do this on all of the controller methods.

So where can I find this view? Where is it located? Any pointers?

除非modelstring ,否则它可能会映射到Index局部视图。

when you don't have view for controller action (for example: Index) you can click right mouse button on "return View();" in controller method to automatically generate view. by default if you have controller with name "AccountController" and action "Index" the view should be in View\\Account\\Index.cshtml [if you use razor].

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM