2 回答

TA貢獻(xiàn)1898條經(jīng)驗(yàn) 獲得超8個(gè)贊
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貢獻(xiàn)2003條經(jīng)驗(yàn) 獲得超2個(gè)贊
右鍵你的mvcwebsite項(xiàng)目屬性
找到WEB一項(xiàng)
選擇啟動(dòng)URL,輸入你要啟動(dòng)的URL就行了,比如/Home/Index
或者
找你的項(xiàng)目配置文件如MvcWebSite.csproj.user
去找 <WebProjectProperties>節(jié)點(diǎn)下的
<StartPageUrl>節(jié)點(diǎn)
里面改成你想啟動(dòng)的路徑就行了如
<StartPageUrl>/Home/Index</StartPageUrl>
- 2 回答
- 0 關(guān)注
- 642 瀏覽
添加回答
舉報(bào)