简体   繁体   English

如何使用ASP.net路由使URL友好

[英]How to use ASP.net Routing to make url friendly

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. 虽然页面很容易记住,但是没有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): 例如,在执行搜索时,在find_provider.aspx ,有三个结果带到provider.aspx页,每个结果都有一个唯一的ID(以后会添加更多):

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? 如何在我的网站上定义每个页面的ID,以使其对用户和搜索友好?

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... 另外,对于article.aspxevent.aspxinfo.aspx等等也是如此...

I am using Ektron CMS and not a MVC in the backend, if it helps to know. 如果有帮助,我在后端使用Ektron CMS,而不使用MVC。

I looked into ASP.net Routing but wasn't sure how to implement it as I am totally new to this process. 我研究了ASP.net路由,但是由于该过程是我的新手,因此不确定如何实现它。

在此处输入图片说明

As you are using Ektron, have you tried using the aliasing feature? 在使用Ektron时,您是否尝试过使用别名功能? This allows for friendly URLs to be created within the CMS. 这允许在CMS中创建友好的URL。 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. 或者,您可能正在使用Smartforms来存储有关提供商的信息。 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. 您可以在此处在工作区中找到所有这些设置:设置>配置> URL别名。 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. 默认情况下,别名是关闭的,因此您需要在“ URL别名”部分的“设置”页面中启用所需的别名类型。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM