2010-11-01 106 views
1

ASP.NET页面在一个典型的Web框架包括从C#

func viewHomepage() 
    response.write(template.render("a string variable", ["an", "array"])) 

是调用模板引擎和出写入输出的一个相当标准的方式。

由于模板引擎位于代码前面,ASP.net显然情况相反。

我正在处理一个无法重写的遗留应用程序。它基本上是一个50行的xxx.aspx,相应的20,000 LOC xxx.aspx.cs.我想要做的是将新的“视图”作为单独的ASP.net窗体和控件编写,然后将它们包括回 xxx.aspx.cs.

本质,而不是这样做的:

case "newfeature": 
{ 
    Response.Write("<table>"); 
    ... 
    Response.Write("</table>"); 
} 
break; 

我想做

case "newfeature": 
    Response.Write(THEFUNCTIONIMLOOKINGFOR("newfeature.aspx")); 
break; 

这样就会有模块化的一些概念,它不会让人想起一个Perl CGI脚本。

请给我一个理智的道路,漂亮 - 请。

回答