在 Visual Studio 2008 中新建 ASP.NET MVC 项目时,默认有一个 Default.aspx 页面。它有一条线
在其 Page_Load 函数中,它只是重定向到“/”以通过路由过程。
public void Page_Load(object sender, System.EventArgs e)
{
HttpContext.Current.RewritePath(Request.ApplicationPath);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
}
我尝试删除 Default.aspx,结果发现默认 URI“ http://localhost:2574/ ”仍然可以访问。那么,为什么还要费心去拥有这样的 Default.aspx 呢?