[英]Code in view does not update after rebuild in ASP.NET MVC 4
四个域都指向同一个网站,所以为了避免重复的内容,我在_Layout.cshtml
的开头写了这段代码:
@if (!Request.Url.Host.Contains("example.com"))
{
Response.Redirect("http://www.example.com" + Request.Url.AbsolutePath, true);
}
然后我意识到它也在本地主机上重定向,所以我将代码更改为:
@if (!Request.Url.Host.StartsWith("localhost") && !Request.Url.Host.Contains("example.com"))
{
Response.Redirect("http://www.example.com" + Request.Url.AbsolutePath, true);
}
但在本地主机上它仍然重定向。 为了确保我完全删除了代码,尝试了Build 、 Rebuild 、 Clean 然后 Rebuild 、 Remove dll files但没有成功。 解决方案构建成功解决方案已构建且未使用旧构建。
为什么删除的代码仍然有效?
清除浏览器的缓存将解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.