码迷,mamicode.com
首页 > Web开发 > 详细

MVC修改起始页

时间:2018-02-06 21:38:48      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:account   ini   ==   col   路由   inf   配置   gis   configure   

app_start下的Startup.cs

app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
//LoginPath = new PathString("/Account/Login"),
LoginPath = new PathString("/Question/Question"),
// by setting following values, the auth cookie will expire after the configured amount of time (default 14 days) when user set the (IsPermanent == true) on the login
ExpireTimeSpan = new TimeSpan(int.Parse(ConfigurationManager.AppSettings["AuthSession.ExpireTimeInDays.WhenPersistent"] ?? "14"), 0, 0, 0),
SlidingExpiration = bool.Parse(ConfigurationManager.AppSettings["AuthSession.SlidingExpirationEnabled"] ?? bool.FalseString)

});

修改路由配置

public class RouteConfig

{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

//ASP.NET Web API Route Config
routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Question", action = "Index", id = UrlParameter.Optional }
);
}
}

 

QuestionnaireNavigationProvider

可以增加导航

public override void SetNavigation(INavigationProviderContext context)
{
context.Manager.MainMenu
.AddItem(
new MenuItemDefinition(
PageNames.Home,
L("HomePage"),
url: "",
icon: "home",
requiresAuthentication: true
)
).AddItem(
new MenuItemDefinition(
PageNames.About,
L("About"),
url: "About",
icon: "info"
)
).AddItem(
new MenuItemDefinition(
"Investigation",
L("Investigation"),
url: "Investigation",
icon: "info"
)
);
}

MVC修改起始页

标签:account   ini   ==   col   路由   inf   配置   gis   configure   

原文地址:https://www.cnblogs.com/Seraph12/p/8424046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!