问题
So I have a URL that looks like this
http://www.test.com/folder1/id=3
But basically when they click the button, in the URL bar i want to display the name of the value associated with that id, for instance id=3 is a watch named "Rollex"
so I want the URL to read
http>//www.test.com/folder1/Rollex
Thank you in advance
回答1:
You should look up URL Routing, its exactly what you want. See ASP.NET Routing.
回答2:
You need Url Rewriting with ASP.NET
A rewrite engine is software that modifies a web URL's appearance (URL rewriting). Rewritten URLs (sometimes known as short, fancy URLs, or search engine friendly - SEF) are used to provide shorter and more relevant-looking links to web pages.
The technique adds a degree of separation between the files used to generate a web page and the URL that is presented to the World.
This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have the option to structure the URLs of your application however you want.
来源:https://stackoverflow.com/questions/6449973/encoding-urls-c-sharp