views:

767

answers:

1

I have implemented VirtualPathProvider class so I can keep all my views in the database instead of FileSystem of web server.

It seems MVC requests aspx page correctly from Database, but unable to request related codebehind .cs files and throws error as unable to load the code-behind class file.

This virtuslPathProvider works like charm with normal Web Form.

Are there any specific changes I will have to make to MVC framework or any other stuff?

Thanks & Regards, Ajay

+1  A: 

ASP.NET MVC is a type of Web Application project. Thus all the code-behind is compiled into an assembly before deployment. It's not like a WebSite project when at the time of the request, the code-behind is compiled.

What that means is that your views have an "Inherits" declaration. The type that they inherit must exist somewhere. If your pages inherit from ViewPage, you're set. If they inherit from ViewPage of T, then you've got issues. The CLR syntax for defining a generic type is ugly. Check out this post for more info.

Here's an example of the syntax:

System.Web.Mvc.ViewPage`1[ [System.Int32,mscorlib] ]
Haacked