ASP.NET Web 窗体
在web.config
文件上,尝试使用clear
之前的标签:
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="Pages/Home.aspx" />
</files>
</defaultDocument>
</system.webServer>
看看这里:http ://www.iis.net/configreference/system.webserver/defaultdocument
ASP.NET MVC / ASP.NET 核心
根据您使用的 asp.net mvc 版本,您可以将它放在不同的文件中(~/Global.asax.cs
在 v3 或更早版本或~/App_Start/RouteConfig.cs
v4 或更高版本中)。在这两种情况下,你都会看到注册路由的东西,因为 asp.net mvc 使用路由而不是像 webforms 这样的文件。因此,您可以更改默认值:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new
{
controller = "Home", // default controller
action = "Index", // default action on the controller
id = UrlParameter.Optional
}
);
}
它在ASP.NET CORE上类似。
看看这里: http: //www.codeproject.com/Articles/624181/Routing-Basics-in-ASP-NET-MVC