2 回答

TA贡献1898条经验 获得超8个赞
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute(".axd/");
routes.MapRoute(
"xiaohong", // Route name
"Home/xiaohong", // URL with parameters
new // Parameter defaults
);
routes.MapRoute(
"chenghong", // Route name
"Home/chenghong", // URL with parameters
new // Parameter defaults
);
routes.MapRoute( //注意Default一定要写到最后
"Default", // Route name
"//", // URL with parameters
new // Parameter defaults
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterRoutes(RouteTable.Routes);
}
}

TA贡献2003条经验 获得超2个赞
右键你的mvcwebsite项目属性
找到WEB一项
选择启动URL,输入你要启动的URL就行了,比如/Home/Index
或者
找你的项目配置文件如MvcWebSite.csproj.user
去找 <WebProjectProperties>节点下的
<StartPageUrl>节点
里面改成你想启动的路径就行了如
<StartPageUrl>/Home/Index</StartPageUrl>
- 2 回答
- 0 关注
- 621 浏览
添加回答
举报