1

I'm confused about routing. In some systems I've seen only naming conventions. In other's I've seen configuration, and in some I've seen both options (like in ASP.NET MVC5).

In the naming convention based system, it seems to be a RewriteRule that puts the URI into a variable and then simply parsed out.

What is the reasoning behind one design over the other? I've always used the naming convention method mentioned above.

2

You use the naming conventions for convenience, and the configuration file for flexibility and explicitness.

In the case of ASP.NET MVC, if you set up a sensible URL structure and get your names right, ASP.NET MVC will automagically wire up your routes and everything just works.

However, if you need a special url formatted in such a way that does not follow the naming conventions, you can still do that by adding the Rewrite rule into the configuration file, while still preserving the routes established by convention.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.