Url routing with database lookup?

后端 未结 4 678
孤街浪徒
孤街浪徒 2021-01-06 12:25

I want to build a ASP.NET MVC site so that the controller for a specific url is stored in the database instead of the URL.

The reason for that is that i\'m building

4条回答
  •  死守一世寂寞
    2021-01-06 13:17

    "for a system with like 100,000 pages it feels like a bad idea."

    It is a bad idea if you are creating a routing system that cannot be reused. The basic {controller}/{action}/{id} schema points you in the direction of reuse. This schema can be extended/revamped/recreated according to your needs.

    Instead of thinking about how many pages you have think about how your resources can be grouped.

    Instead of creating a heavy routing system why not create an anchor link control (ascx) which allows user to only add valid internal links. Keep a table in the db of your templates and their controllers to populate the control with it.

提交回复
热议问题