Question

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

Was it helpful?

Solution

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 doesn't 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.

This might be a useful resource.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top