2010-11-01 61 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腳本。

請給我一個理智的道路,漂亮 - 請。

回答