RouteConfig.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Mvc;
  6. using System.Web.Routing;
  7. namespace M55128_rec
  8. {
  9. public class RouteConfig
  10. {
  11. public static void RegisterRoutes(RouteCollection routes)
  12. {
  13. routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  14. routes.MapMvcAttributeRoutes();
  15. //routes.MapRoute(
  16. // name: "Action1Html", // action伪静态
  17. // url: "{controller}/{action}.html",// 带有参数的 URL
  18. // defaults: new { controller = "ZX", action = "Index", id = UrlParameter.Optional }
  19. //// 参数默认值
  20. //);
  21. // routes.MapRoute(
  22. // name: "index",
  23. // url: "{controller}/{action}/{id}",
  24. // defaults: new { controller = "KJ", action = "Index", id = UrlParameter.Optional },
  25. // namespaces: new[] { "M55128_rec.Controllers" }
  26. //).DataTokens.Add("area", "kj");
  27. routes.MapRoute(
  28. name: "Default",
  29. url: "{controller}/{action}/{id}",
  30. defaults: new { controller = "Home", action = "MainIndex", id = UrlParameter.Optional }
  31. );
  32. }
  33. }
  34. }