2 回答

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