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
  • 732,580
  • 175
  • 1,330
  • 1,459
user547794
  • 14,263
  • 36
  • 103
  • 152

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
  • 1,023,142
  • 271
  • 3,287
  • 2,928