Note that there are some explanatory texts on larger screens.

plurals
  1. PORazor view Type does not inherit from 'System.Web.WebPages.WebPage'
    primarykey
    data
    text
    <p>I have a problem with configuring asp.net mvc application:</p> <pre><code>[HttpException (0x80004005): Type 'ASP._Page_Currency_Index_cshtml' does not inherit from 'System.Web.WebPages.WebPage'.] System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp) +11454171 System.Web.WebPages.BuildManagerWrapper.CreateInstanceOfType(String virtualPath) +347 System.Web.WebPages.VirtualPathFactoryManager.CreateInstanceOfType(String virtualPath) +239 System.Web.WebPages.WebPageHttpHandler.CreateFromVirtualPath(String virtualPath, IVirtualPathFactory virtualPathFactory) +57 System.Web.WebPages.WebPageRoute.DoPostResolveRequestCache(HttpContextBase context) +407 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) +270 </code></pre> <p>Steps that I want to do:</p> <ul> <li>Move controllers with its views into separate library and put dll into bin folder.</li> <li><p>Create virtual file provider and virtual file to get data from assembly:</p> <pre><code>public override Stream Open() { var resourceName = this.path; var asmName = this.assembly.GetName().Name; var manifestName = asmName + ".Views" + resourceName.Trim('~').Replace("/", "."); var resourceStream = this.assembly.GetManifestResourceStream(manifestName); return resourceStream; } </code></pre></li> <li><p>Add this lines into web.config:</p> <pre><code>&lt;configSections&gt; &lt;sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"&gt; &lt;section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt; &lt;section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" /&gt; &lt;/sectionGroup&gt; &lt;/configSections&gt; &lt;system.web.webPages.razor&gt; &lt;host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt; &lt;pages pageBaseType="System.Web.Mvc.WebViewPage"&gt; &lt;namespaces&gt; &lt;add namespace="System.Web.Helpers" /&gt; &lt;add namespace="System.Web.Mvc" /&gt; &lt;add namespace="System.Web.Mvc.Ajax" /&gt; &lt;add namespace="System.Web.Mvc.Html" /&gt; &lt;add namespace="System.Web.Routing" /&gt; &lt;add namespace="System.Web.WebPages" /&gt; &lt;/namespaces&gt; &lt;/pages&gt; &lt;/system.web.webPages.razor&gt; </code></pre></li> <li><p>When user access this controller's page it is compiled correctly into the following class:</p> <pre><code>public class _Page_Currency_Index_cshtml : System.Web.Mvc.WebViewPage&lt;GridModel&lt;CurrencyModel&gt;&gt; { </code></pre></li> <li><p>And after that it fails with this error (and as I can see - he is right, Type 'ASP._Page_Currency_Index_cshtml' does not inherit from 'System.Web.WebPages.WebPage'.)</p></li> </ul> <p>What should I do to let HttpApplication know that this page should be managed as System.Web.Mvc.WebViewPage instead of System.Web.WebPages.WebPage?</p> <p>I have tried to move Views/Web.Config into bin folder, but it does not help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload