views:

342

answers:

1

I would like to implement a ASP.NET MVC View Engine to perform some pre-processing of the original .aspx/.ascx. file. Then, I want to pass the result to the default view engine (typically the WebForm View Engine).

This means, the default View Engine shouldn't read this file from disk, since this is not yet processed. Instead, i would want the View Engine to read the input from an input stream.

Is this possible? Should i create a new file extension mapped to this pre-processing view engine?

thx

+1  A: 

You going to need to create a custom viewengine that reads the aspx files, modifies them as you need, then passes them to some build provider. The WebFormsViewEngine uses the System.Web.Complilation.BuildManager class to build the aspx files. The problem you will have is that the BuildManager only accepts virtual paths, it doesnt accept streams or strings. This means that you will probably have to make your own build manager as well. Look around in the System.Web.Compilcation namespace to see if you can find anything that may help out. Below are a few sources that may point you in the right direction.

http://aspnet.codeplex.com/SourceControl/changeset/view/21528#266536

http://aspnet.codeplex.com/SourceControl/changeset/view/21528#266536

Nathan Totten
thx for answering, i didnt have much hope left that someone would reply. And you make some good points, 2. You are probably right that i will need my own build manager. I will look into this, and might also accept this answer in the near future.
baretta