将包含GUID的URl重写为查询字符串C#
我目前正在做一个需要大量重写的项目 当前URL包含guid,如下所示:将包含GUID的URl重写为查询字符串C#,c#,C#,我目前正在做一个需要大量重写的项目 当前URL包含guid,如下所示: http://localhost:88/en-GB/search/?country=f8c889dd-6c8c-4623-8304-17e575c6b5f5&c360=&postcode=&distance=&m=&model=20d6bcfd-409f-49d7-8692-4cb423105c7e&b=&der=&tra=&col=&max
http://localhost:88/en-GB/search/?country=f8c889dd-6c8c-4623-8304-17e575c6b5f5&c360=&postcode=&distance=&m=&model=20d6bcfd-409f-49d7-8692-4cb423105c7e&b=&der=&tra=&col=&maxm=&maxp=&d=&maxage=
http://localhost:88/uk/bosch/...
我想实现这样的目标:
http://localhost:88/en-GB/search/?country=f8c889dd-6c8c-4623-8304-17e575c6b5f5&c360=&postcode=&distance=&m=&model=20d6bcfd-409f-49d7-8692-4cb423105c7e&b=&der=&tra=&col=&maxm=&maxp=&d=&maxage=
http://localhost:88/uk/bosch/...
我无法映射web.config中的所有组合(需要保持在250kb以下);一个代码解决方案,库可能会有所帮助
多谢各位
IIS 7
.net 3.5
SQLAzure
visual studio 2013
尝试映射所有组合
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="default.aspx" defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="SearchResults2" virtualUrl="^~/(en-GB)/uk/?$" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/_search.aspx?_identifier=search/&_locale=$1&c=7309d34a-d467-48dc-8324-9a9c9856c486" ignoreCase="true" />
它们似乎可以工作,但不能将它们全部(成千上万)放在live网站web.config上
我可以在您正在使用的asp.net的哪个版本中,从db获得每个代码到等效字符串的映射?请提供更多关于您环境的信息。您尝试过什么吗?是否有一个表将GUID映射到国家代码/型号名称?如果它们在数据库中,则创建一个404处理程序,该处理程序将检查是否找到URL并重定向,或者根据该URL给出实际的错误页面。