2014-01-10 27 views
0

当我的MVC4网站(mywebsite.com)部署到亚马逊网络服务(Amazon Web Services)并且未经过身份验证的用户单击需要身份验证的链接(例如搜索)时,它们被重定向到MVC重定向将Web根插入URL

Web.UI_deploy /帐号/的

www.mywebsite.com/ 登录?RETURNURL =%2fSearch

代替

www.myweb site.com/Account/Login?ReturnUrl=%2fSearch

Web.UI_deploy是Web服务器上的Web根目录)。这个问题只发生在部署上,而不是在本地主机上。

解决此问题的最简洁方法是什么?

回答

1

在web.config中的小变化可以解决问题

之前

<authentication mode="Forms"> 
     <forms loginUrl="~/Account/Login" timeout="2880" /> 
</authentication> 

我删除了波浪号〜,它解决了这个问题

<authentication mode="Forms"> 
     <forms loginUrl="/Account/Login" timeout="2880" /> 
</authentication> 

我从Issue with return URL Authorize issue MVC4

+0

这样的想法,你可以提供你原来的web.config在原来的职位是什么样子?如果他们遇到同样的问题,这将帮助其他人。您的答案可能有助于解决您的问题,但以后不会帮助其他用户 –