【发布时间】:2019-01-25 09:53:30
【问题描述】:
我正在为 asp.net mvc 5 应用程序设置一个带有 windows Azure VM 的新服务器。除了一个控制器,我可以毫无问题地打开应用程序的每一页。即,每当我尝试打开属于特定控制器的页面时,它都会提示我输入用户名和密码,如下所示。
我在不同的 Windows Server 2016 VM 中使用相同的应用程序,没有任何问题。
我也没有看到应用程序/IIS 日志的任何错误。我在应用程序中没有任何 https 要求。
什么可能导致这种行为?
namespace App.Controllers
{
public class ReportsController : BaseController
{
private readonly IReportRepository reportRepository;
public ReportsController(): this(new ReportRepository()){
}
public ReportsController(IReportRepository reportRepository){
this.reportRepository = reportRepository;
}
public ViewResult Action()
{
return View(reportRepository.All);
}
}
}
namespace App.Controllers
{
[Authorize]
public class BaseController : Controller
{
}
}
更新:我将 ReportsController 重命名为 AppReportsController,问题就消失了。 即当我尝试访问时收到上述提示
但不是为了
请有人向我解释一下这里发生了什么?这是否意味着“报告”被框架保留了?
【问题讨论】:
-
如果您不使用传输层安全性(即 HTTPS!),那么浏览器会告诉您这一点,因为您通过不安全的连接发送凭据,很容易被恶意人员嗅探。跨度>
-
如果是这样,其他页面如何正常工作? BaseController 也继承了所有其他控制器。
-
每当您看到密码弹出窗口并且您的连接不安全时,您都会看到该消息。
-
从图片看你使用的是HTTP(不带S后缀)和登录时通常用于提交秘密凭据的密码输入,因此在使用不安全协议时会触发安全问题警告。
-
用户在加载此特定页面之前已登录应用程序。我只收到属于 ReportsController 的任何操作的提示。对于来自不同控制器的任何其他页面,我没有看到此提示。
标签: c# asp.net-mvc windows-server-2016 iis-10