分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 代码编程

MVC修改起始页

发布时间:2023-09-06 01:41责任编辑:赖小花关键词:MVC

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修改起始页

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

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved