首页 > 编程语言 >Asp.net Mvc 区域路由默认设置

Asp.net Mvc 区域路由默认设置

时间:2022-09-05 10:02:04浏览次数:53  
标签:Asp 默认设置 routes controller Mvc action new id

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

            routes.MapRoute(name: "routeArea",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional })
                .DataTokens = new RouteValueDictionary(new { area = "Login" });

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

 

标签:Asp,默认设置,routes,controller,Mvc,action,new,id
From: https://www.cnblogs.com/litianfeng-net/p/16657038.html

相关文章

  • springMVC 获取参数
    1.servlet@GetMapping("/params")publicStringtest5(HttpServletRequestrequest){Stringusername=request.getParameter("username");Stringpassword......
  • 2.注解开发springmvc
    通用配置:<?xmlversion="1.0"encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-i......
  • SpringMVC
    1、概述SpringMVC是SpringFramework的一部分,是基于Java实现MVC的轻量级Web框架。SpringMVC的特点:轻量级,简单易学高效,基于请求响应的MVC框架与Spring兼容性好,无......
  • ASP.NET Core源码,数据结构和算法,
    ASP.NETCore源码:https://github.com/dotnet/aspnetcore#ASP.NETCorehttps://github.com/dotnet/runtime#extend扩展库https://github.com/aspnet/KestrelHttpServer ......
  • 15.web开发-SpringMVC自动配置概览
    SpringBootprovidesauto-configurationforSpringMVCthatworkswellwithmostapplications.(大多场景我们都无需自定义配置)Theauto-configurationaddsthef......
  • SpringMVC学习笔记(四)——REST风格
    1.什么是REST RESTful(REST风格)是一种当前比较流行的互联网软件架构模式,它充分并正确地利用HTTP协议的特性,为我们规定了一套统一的资源获取方式,以实现不同终端之间(客......
  • SpringMVC学习笔记(三)——请求转发与重定向
    1.请求转发 我们可以在控制器方法指定逻辑视图名(ViewName)时,使用“forward:”关键字进行请求转发操作。当控制器方法中所设置的逻辑视图名称以“forward:”为前缀时,该逻......
  • 一篇文章教你学会ASP.Net Core LINQ基本操作
    一篇文章教你学会ASP.NetCoreLINQ基本操作为什么要使用LINQLINQ中提供了很多集合的扩展方法,配合lambda能简化数据处理。例如我们想要找出一个IEnumerable<int>中所有......
  • ASP.NET Core 实战-10.使用依赖注入的服务配置
    依赖注入简介本节旨在让您基本了解什么是依赖注入,为什么要关注它,以及ASP.NETCore如何使用它。该主题本身远远超出了这一章的范围。如果您想要更深入的背景,我强烈建议......
  • ASP.NET Core 实战-8.使用标签助手构建表单
    显示动态数据是许多Web应用程序的一个重要方面,但它通常只是故事的一半。除了向用户显示数据之外,您通常还需要用户能够将数据提交回您的应用程序。例如,您可以使用数据来......