【发布时间】:2014-01-03 20:21:51
【问题描述】:
IIS 7 运行 ASP.NET MVC 4 应用程序。我在 IIS 中为网站启用了基本身份验证,并禁用了所有其他身份验证类型。当用户到达该站点时,他们会看到身份验证挑战弹出窗口,他们使用其域凭据进行身份验证。
但是,在成功验证后,它们将被重定向到 `/login.aspx?ReturnURL=originalPath。
理想情况下,我希望重定向将它们发送回原始请求的 URL。我该怎么做?
为了更具体地说明我要完成的工作,我们在http://nuger.ourdomain.com/nuget 运行了一个内部 NuGet 提要。 NuGet 支持基本身份验证。但是,由于这种错误的重定向,我的 nuget.exe install 命令失败了。例如
https://nuget.ourdomain.com/nuget -> password challenge
-> redirects to https://nuget.ourdomain.com/login.aspx?ReturnUrl=%2fnuget
-> Returns 404 Not Found because there is no login.aspx on this MVC app
-> NuGet sees the 404 and sees that something failed,
so prompts for passsword again, ad infinitum
如果我在浏览器中浏览到https://nuget.ourdomain.com/nuget,我可以直接看到这种行为——我收到了身份验证挑战,然后重定向到/login.aspx?ReturnUrl=%2fnuget。那时,如果我手动转到我的原始目标 URL,它会正常加载。
使用基本身份验证有办法将正确的重定向返回到原始请求 url?
【问题讨论】:
标签: asp.net-mvc iis iis-7 nuget basic-authentication