我在站点地图中得到了一些不存在的链接(404)mvc项目

时间:2019-06-11 11:20:34

标签: asp.net-mvc routes sitemap

我有一个项目,当我想从www.xml-sitemaps.com生成站点地图xml时,我得到了一些不存在的链接。如何删除这些链接?

这是我的路线:

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

        routes.MapRoute(
        "OnlyAction",
        "{action}",
        new { controller = "Home", action = "Index" }
     );

        routes.MapRoute(
         name: "Product",
         url: "Products/{ProductName}",
         defaults: new { controller = "Home", action = "ShowProducts", ProductName = UrlParameter.Optional }
     );

        routes.MapRoute(
          name: "Categories",
          url: "Categories/{CategoryName}",
          defaults: new { controller = "Home", action = "ShowCategories", CategoryName = UrlParameter.Optional }
      );

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

,我有“ ShowProducts”和“ ShowCategories”的控制器。 我可以像下面这样正确地获得所有链接:

https://mywebsite.com/Categories/CategoryName01
https://mywebsite.com/Products/ProductName01

但是最后,mywebsite中不存在一些链接,例如:

https://mywebsite.com/Products/Categories/CategoryName01
https://mywebsite.com/Products/Categories/CategoryName02
https://mywebsite.com/Products/Categories/CategoryName03

请帮助我找到这些路线从哪里来?以及如何删除它们?

0 个答案:

没有答案