How to handle stackoverflow question urls in asp.net mvc controller?

I would like to know how to configure routing in asp.net mvc so that I have similar urls for stackoverflows urls?

Do you think ASP.Net MVC is ready for production?

I assume that there is a helper class to create the urls that creates the urls of the question.

The part that I am wondering is how this is implemented on the controller side. I think that most likely the home controller has questions, and the identifier is 115634. Then the name of the question appears - I think this is for search engine optimization. My problem is what the controller signature will look like.

Is it a question (int? Id) or Question (string? Param) that contains both id and title?

How to implement this?

+3
source share
2 answers

Check out this question , where Jeff Atwood himself publishes the code that they use to create a friendly URL. Also, I'm not a C # developer, so I'm not sure how ASP.NET MVC works, but if you try to remove the header in the StackOverflow URL, the page will work anyway. They are 100% readable for people (so they know what to expect when they see a link) and for search engines. As such, I would expect that if you wanted something like this, you would make it an optional parameter in the controller.

+5
source

question... , (:

0

Source: https://habr.com/ru/post/1704141/


All Articles