【发布时间】:2018-03-29 16:43:42
【问题描述】:
我有两个 MVC Web 应用程序,一个 www.company.com 和一个 solution.company.com
网站 www.company.com 包含指向 solution.company.com/Contact 的链接,但我如何在视图中设置 href 以便能够在开发/预生产/生产环境中对其进行测试?
开发人员:
<a href="http://localhost:88/Contact/">Contact Us</a>
质量检查:
<a href="http://qa.solution.company.com/Contact/">Contact Us</a>
珠三角:
<a href="http://solution.company.com/Contact/">Contact Us</a>
【问题讨论】:
-
是在您运行 Web 应用程序的同一个网站中“联系我们”还是外部网站?
-
您好,它在不同的 Web 应用程序(网站)中,但在同一个解决方案中。
-
您只需要使用
Url帮助器并让MVC 为您生成URL。像<a href="@Url.Action("Index", "Contact")">Contact Us</a>这样的东西就是你所需要的。 MVC 将确保使用正确的主机名。 -
你使用的是什么版本的 MVC?
-
@BrendanGreen 嗨,该操作在另一个 Web 应用程序中
标签: c# asp.net-mvc