asp.net mvc修改默认路由(刚刚运行进入那个页面由你控制)
namespace MvcApplication4
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Default1", action = "Ajax", id = UrlParameter.Optional }
);
}
}
}
修改default:部分即可,如图,跳转到localhost/Default1/Ajax