วิธีที่ดีที่สุด URL กำหนดเส้นทาง Visual Studio C#

URL นี้ทำงานได้ดี http://localhost:64333/get/5/6/1

แต่ URL นี้ใช้งานไม่ได้ http://localhost:64333/get/5/6/index-1.shtml ไม่พบหน้า 404

   routes.MapRoute(
                 "OnlyAction",
                "{action}/{id}/{sub_id}/{page_no}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional, sub_id = UrlParameter.Optional, page_no = UrlParameter.Optional }
                ); 
 routes.MapRoute(
               name: "Idpages",
               url: "{action}/{id}/index-{page_no}.shtml",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, sub_id = UrlParameter.Optional, page_no = UrlParameter.Optional }
                );
            routes.MapRoute(
              name: "subIdPages",
              url:   "{action}/{id}/{sub_id}/index-{page_no}.shtml",
               defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional, sub_id = UrlParameter.Optional, page_no = UrlParameter.Optional }
                ); 

person Jasveer Singh    schedule 03.07.2021    source แหล่งที่มา
comment
หากคุณต้องการ MapRoute เป็นไฟล์ html คุณสามารถดูคำตอบแรกได้ในลิงก์ C# .net MapRoute เป็นไฟล์ html   -  person Jack J Jun - MSFT    schedule 05.07.2021