Eric Hester wrote a detailed post on how to use areas in an MVC project. Jeffery Palermo wrote on how to use portable areas in a webforms project.
Portable areas projects stores all the views in the assembly as enbedded resources. Normally asp.net runtime look for the page in the file system. We can change this behavior by making the following call in the application start event of the global.asax file.
HostingEnvironment.RegisterVirtualPathProvider (YourVirtualPathProvider);
Portable areas feature in MVCContrib simply does that. MvcContrib profject supplies a VirtualPathProvider called AssemblyResourceProvider.
However the above call will fail quietly if your website is precompiled. This behavior is documented in an MSDN article. So in order to use the portable areas in your webforms project, you should not use precompile option in the website project.
No comments:
Post a Comment