一、路由规则:
routes.MapRoute(
                name: "Default1",
                url: "more_{root}_{plate}.html",
                defaults: new { controller = "about", action = "Index", root = UrlParameter.Optional, plate = UrlParameter.Optional }
            );

二、定义URL:
<a href="@Url.Action("index", "about", new { root = 1, plate = 2 })">123456</a>

三、在VIew获取参数:
<p>root: @(Url.RequestContext.RouteData.Values["root"])</p>
<p>plate: @(Url.RequestContext.RouteData.Values["plate"]) </p>

还需要在webconfig配置:

ASP.NET MVC5 实现网址伪静态

public IEnumerator <string> GetEnumerator()// 注意:返回什么,泛型就为什么类型
    {
        for (int i = 0; i<arr_Course.Length; i++)
        {
            Course course = arr_Course[i];
            yield return "选修:" + course.Name;
            yield return Environment.NewLine;// 两个 yield return
        }
    }
public IEnumerator <string> GetEnumerator()// 注意:返回什么,泛型就为什么类型
    {
        for (int i = 0; i<arr_Course.Length; i++)
        {
            Course course = arr_Course[i];
            yield return "选修:" + course.Name;
            yield return Environment.NewLine;// 两个 yield return
        }
    }

  

相关文章:

  • 2021-09-14
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2021-08-13
猜你喜欢
  • 2022-02-10
  • 2022-01-06
  • 2022-12-23
  • 2021-06-25
  • 2021-12-16
  • 2021-07-15
相关资源
相似解决方案