zoukankan      html  css  js  c++  java
  • Asp.Net MVC3(一)多Area时,路由设置问题

    在添加多个Area时,如添加:AreaTest ,需求修改AreaTestAreaRegistration.cs

    View Code
    public class AreaTestAreaRegistration : AreaRegistration
    {
    public override string AreaName
    {
    get
    {
    return "AreaTest";
    }
    }

    public override void RegisterArea(AreaRegistrationContext context)
    {
    context.MapRoute(
    "AreaTest_default",
    "AreaTest/{controller}/{action}/{id}",
    new { action = "Index", id = UrlParameter.Optional },
    null,
    new string[] { "Mini.WebAppMvc3.Areas.AreaTest.Controllers.*" }
    );
    }
    }


    修改RegisterArea方法,添加两个参数.

    public override void RegisterArea(AreaRegistrationContext context)
    {
    context.MapRoute(
    "AreaTest_default",
    "AreaTest/{controller}/{action}/{id}",
    new { action = "Index", id = UrlParameter.Optional },
    null,
    new string[] { "Mini.WebAppMvc3.Areas.AreaTest.Controllers.*" }
    );
    }
  • 相关阅读:
    Django 中间件
    Django之ORM介绍
    ORM相关操作
    Django Form表单
    Django REST framework 中文文档
    前端基础之BOM和DOM
    Django--ORM(2)
    Django--视图
    Django--路由系统
    Django--模板语言
  • 原文地址:https://www.cnblogs.com/snlfq2000/p/2337239.html
Copyright © 2011-2022 走看看