0

I am wondering if there is a way to store partial views outside of the application's root folder. The advantage being that all applications would be able to use these partials, and there would be a single location to make HTML updates without re-deploying a new .bin to each app.

@Html.Partial("../../../../../../../../PartialTest/PartialTest.cshtml")

This is giving me the error:

Cannot use a leading .. to exit above the top directory.

Is something like this possible?

marc_s
  • 704,970
  • 168
  • 1,303
  • 1,425
user547794
  • 13,653
  • 35
  • 100
  • 149

1 Answers1

1

I am wondering if there is a way to store partial views outside of the application's root folder.

You will have to write a custom virtual path provider if you want to support that. For example you may take a look at the following question for an example of such a custom provider reading views from embedded resources. You could adapt it to read views from whatever location you want.

Community
  • 1
  • 1
Darin Dimitrov
  • 994,864
  • 265
  • 3,241
  • 2,902