How do I create userfriendly urls like stackoverfl

2020-06-17 05:46发布

I want to create a similar type of url as stack overflow does when a question is created.

Example:

Non-ajax GET/POST using jQuery (plugin?)non-ajax-get-post-using-jquery-plugin

I am particularly interested in the last part which I have highlighed in bold. How do you achieve the affect of adding the title of the page to the url with the delimiter?

What is this technique called?

7条回答
Rolldiameter
2楼-- · 2020-06-17 06:29

Use ASP.NET routing rather than rewriting when possible. It's available with both MVC and Web Forms. Routing is much more flexible and does a better job in passing context to the processing code, handling postbacks, etc.

You can also use the IIS7 Rewrite Module to handle rewriting at the webserver level before your ASP.NET code executes. There's some good information on how to do that here.

查看更多
登录 后发表回答