How to use ASP.net Routing to make url friendly

只谈情不闲聊 提交于 2019-12-25 06:47:32

问题


I have the following pages:

Default.aspx
find_provider.aspx --> (has a search which takes the user to each provider page) --> provider.aspx?id={####}
news.aspx --> (has links to each news) --> article.aspx?id={####}
health.aspx --> (has links to each event) --> event.aspx?id={####}
patinfo.aspx --> (has links to each info) --> info.aspx?id={####}

Although the page are easy to remember but not the ID.

For example, in the find_provider.aspx when a search is performed, there are three results which takes to provider.aspx page, each with a unique ID (with more added in the future):

Bolt, John MD --> provider.aspx?id=90
Barry, Brent MD --> provider.aspx?id=1090
Carson, John MD --> provider.aspx?id=10

How can I set up my web site where I an define what each page's ID will be for making it user and search friendly?

For example:

Bolt, John MD --> provider.aspx/johnbolt
Barry, Brent MD --> provider.aspx/brentbarry
Carson, John MD --> provider.aspx/johncarson

Also, the same for the article.aspx, event.aspx, and info.aspx and so on...

I am using Ektron CMS and not a MVC in the backend, if it helps to know.

I looked into ASP.net Routing but wasn't sure how to implement it as I am totally new to this process.


回答1:


As you are using Ektron, have you tried using the aliasing feature? This allows for friendly URLs to be created within the CMS. There are different types of aliasing avaiable, please see here for more information.

It is possible to create friendly aliases to a user's profile by creating an Automatic Aliasing rule for Users.

Alternatively, you may be using Smartforms to store information about your Providers. If so, you can create Automatic Aliases for Content by mapping a rule to either your folder structure or a taxonomy.

You can find all these settings in your Workarea here: Settings > Configuration > URL Aliasing. By default aliases are turned off so you will need to enable the alias types you require in the Settings page within the URL Aliasing section.



来源:https://stackoverflow.com/questions/26931571/how-to-use-asp-net-routing-to-make-url-friendly

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