ASP MVC3 本地化 URL 查询字符串参数
我已经知道如何本地化 ASP.NET MVC3 URL(使用 此技术)。
这个解决方案非常优雅,我已经设法根据我的需求进行调整。
但现在我遇到了这个小(或者相当大)的问题:
如何才能拥有本地化的 url 查询参数?
例如,如何才能拥有此(美国)英文版
英文 URL: http:// www.mysite.com/en-US/Classifieds/Search?ZipCode=92274
德语 (DE) 版本: http://www.mysite.com/de-DE/Anzeigen/Suche ?Postleitzahl=71710
西班牙语 (ES) 版本: http://www.mysite.com/es-ES/Clasificados/Busqueda ?Codigo_postal=08110
看到粗体部分了吗?这就是我要找的!
预先感谢
PS。我需要这个,因为我认为这会带来更好的 SEO 排名。有谁可以证实这一点吗?
I already know how to localize an ASP.NET MVC3 URL (using this technique).
This solution is very elegant and i already managed to tweak it to my needs.
But now i have this small (or rather huge) problem:
how is it possible to have localized url query parameters?
For example how is it possible to have this (US) english version
english URL: http://www.mysite.com/en-US/Classifieds/Search?ZipCode=92274
german (DE) version:
http://www.mysite.com/de-DE/Anzeigen/Suche?Postleitzahl=71710
spanish (ES) vesrion:
http://www.mysite.com/es-ES/Clasificados/Busqueda?Codigo_postal=08110
See the bolded part? This is what i'm looking for!
Thanks in advance
PS. I need this cause i think this will give much better SEO rankings. Is there anyone who can confirm this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以想出几种方法来满足您的需要。您可能想尝试创建自己的 HTML 帮助器来构建本地化链接。这可能包括基于数据库表的翻译逻辑(baseName、Culture、translation)。完成此操作后,您可以引用 Request 对象并按索引获取参数,或者创建一个逻辑来转换回(再次基于您的表)基本名称。
关于您的 SEO 问题 - 我只知道 MVC 重写逻辑和链接的“友好性”是基于这样一个事实:静态链接的爬行速度比动态链接快。因此,这是您网站上需要考虑的事情。( http ://www.seo-consultant-services.co.uk/static-html-vs-dynamic-urls.html)我不是专家,但我想翻译你的网址参数是有意义的,如果你期望用户搜索像这样的服务,例如“邮政编码 92274 附近”(我可能是错的)
I can think of several ways of doing what you need. You may want to try to create your own HTML helper for localized links building. That could include the translation logic based on db table ( baseName, Culture, translation ). Once you've got this in place you either could refer to Request object and get the parameter by index, or create a logic to translate back ( again based on your table) to the base name.
Regarding your SEO question - I only know that MVC rewriting logic and 'friendliness' of the links is based on the fact that static-looking links are crawled faster then the dynamic ones. So that's something to consider on your site.( http://www.seo-consultant-services.co.uk/static-html-vs-dynamic-urls.html) I'm not an expert but I would guess that translating your url parameters makes sense if you expect users to search for services like this for example ' near ZipCode 92274' (I may be wrong)