ASP .NET MVC - 由URL.Action用于更改域名? [英] ASP .NET MVC - Change domain used by URL.Action?

查看:103
本文介绍了ASP .NET MVC - 由URL.Action用于更改域名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网站,有指向相同的内容两个领域。让我们把他们www.domainA.com和www.domainB.com哪里www.domainA.com/Page相同www.domainB.com/Page。

I have a website that has two domains pointing to the same content. Let's call them www.domainA.com and www.domainB.com where www.domainA.com/Page is the same as www.domainB.com/Page.

在网站上每个页面有一些正在使用的Url.Action和Html.ActionLink调用构造混合常见的导航链接(及其他)。所得网址是基于当前域。由于www.domainA.com是主域,我想从www.domainB.com产生的任何链接是基于www.domainA.com。

Every page on the site has a number of common navigation links (and others) that are constructed using a mixture of Url.Action and Html.ActionLink calls. The resulting urls are based on the current domain. Because www.domainA.com is the primary domain, I would like any links generated from www.domainB.com to be based on www.domainA.com.

可以这样集中完成,而不是我去整个站点进行硬编码呢?

Can this be done centrally, rather than me going around the whole site and hard-coding it?

谢谢,
阿伦

推荐答案

我结束了在这里使用的解决方案 来指导IIS重写请求我的老域名。

I ended up using the solution here to instruct IIS to rewrite requests to my old domain.

希望这有助于其他有同样的要求。

Hope this helps others with the same requirement.

阿伦

这篇关于ASP .NET MVC - 由URL.Action用于更改域名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆