mvc 3 没首页文件,调试或者在浏览器中查看 都不方便;
可以将mvc2 的首页文件放到项目里面就方便多了;
在项目跟目录添加: Default.aspx
public void Page_Load(object sender, System.EventArgs e)
{
// Change the current path so that the Routing handler can correctly interpret
// the request, then restore the original path so that the OutputCache module
// can correctly process the response (if caching is enabled).
string originalPath = Request.Path;
HttpContext.Current.RewritePath(Request.ApplicationPath, false);
//throw new Exception(originalPath + "---" + Request.ApplicationPath);
IHttpHandler httpHandler = new MvcHttpHandler();
httpHandler.ProcessRequest(HttpContext.Current);
HttpContext.Current.RewritePath(originalPath, false);
}
MVC是路由映射的,改成HOME/INDEX就可以了,没有.aspx后缀