Home > Enterprise >  Searching paths for ViewComponent in ASP.NET
Searching paths for ViewComponent in ASP.NET

Time:07-15

In general if we use View("Index"). It will search for views in Views/ControllerName or Views/Shared folder. Likewise if we use Component.InvokeAsync("SomeData") then what are the paths it will search for that viewcomponent

CodePudding user response:

Since it is a component, runtimes will search into components folder as stated below:

  • /Views/{Controller Name}/Components/{View Component Name}/{View Name}
  • /Views/Shared/Components/{View Component Name}/{View Name}
  • /Pages/Shared/Components/{View Component Name}/{View Name}

source: microsoft docs

  • Related