Encoding Urls C#

ぐ巨炮叔叔 提交于 2019-12-10 18:09:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!