MVC view engine that can render classic ASP?

Posted by David Lively on Stack Overflow See other posts from Stack Overflow or by David Lively
Published on 2010-04-05T14:38:02Z Indexed on 2010/04/05 14:43 UTC
Read the original article Hit count: 402

Filed under:
|
|

I'm about to start integrating ASP.NET MVC into an existing 200k+ line classic ASP application. Rewriting the existing code (which runs an entire business, not just the public-facing website) is not an option.

The existing ASP 3.0 pages are quite nicely structured (given what was available when this model was put into place nearly 15 years ago), like so:

<!--#include virtual="/_lib/user.asp"-->
<!--#include virtual="/_lib/db.asp"-->
<!--#include virtual="/_lib/stats.asp"-->
<!-- #include virtual="/_template/topbar.asp"-->
<!-- #include virtual="/_template/lftbar.asp"-->
<h1>page name</h1>
<p>some content goes here</p>
<p>some content goes here</p>
<p>.....</p>
<h2>Today's Top Forum Posts</h2>
<%=forum_top_posts(1)%>
<!--#include virtual="/_template/footer.asp"-->

... or somesuch. Some pages will include function and sub definitions, but for the most part these exist in include files.

I'm wondering how difficult it would be to write an MVC view engine that could render classic ASP, preferably using the existing ASP.DLL. In that case, I could replace

<!--#include virtual="/_lib/user.asp"-->

with

<%= Html.RenderPartial("lib/user"); %>

as I gradually move existing pages from ASP to ASP.NET. Since the existing formatting and library includes are used very extensively, they must be maintained. I'd like to avoid having to maintain two separate versions.

I know the ideal way to go about this would be to simply start a new app and say to hell with the ASP code, however, that simply ain't gonna happen.

Ideas?

© Stack Overflow or respective owner

Related posts about classic-asp

Related posts about asp.net-mvc