2

I want to force views in a folder (for example folder associated with ArticleController, named Article in View directory) that inherits from a CustomViewClass. Note that I know how to change inheritance in Razor views, I do it. Now I want to change again for a special directory views. How can I do it?

tereško
  • 58,060
  • 25
  • 98
  • 150
amiry jd
  • 27,021
  • 30
  • 116
  • 215

1 Answers1

2
  1. Create a file in Article directory and name it Web.config
  2. Copy and paste code below in it:

<?xml version="1.0"?>

<configuration>

  <system.web.webPages.razor>
    <pages pageBaseType="Your.NameSpace.CustomViewClass">
    </pages>
  </system.web.webPages.razor>

</configuration>

Now all views in Article directory, will inherit from CustomViewClass.

amiry jd
  • 27,021
  • 30
  • 116
  • 215