我有一个网站写在ASP.Net MVC4并部署到IIS7.5,用户首先需要先登录才能浏览网页的其余部分,例如,这里的源代码如下所示:强制HTTP而不是HTTPS
路线:
localhost/project/account/logon
localhost/project/apple
localhost/project/banana
登录方法:
[RequireHttps]
public ActionResult Logon(string returnUrl)
{
...
return View();
}
[HttpPost]
public ActionResult Logon(string user, string pwd, bool remember)
{
...
string url = "/apple";
return Redirect(url);
}
的问题是,用户后登录,我们将用户重定向到其他链接使用return Redirect('/apple')
,该机还采用HTTPS https://localhost/project/apple
访问新的链接。
如何防止使用HTTPS重定向?