我遇到的一个问题是:如果我将LoginPath设置为“/account/”,那么注销的用户最终会出现无限重定向循环(不是真的;它会一直扩展returnURL,直到服务器因查询字符串过长而阻止请求为止。这发生在
/account/
但是
/account/default.aspx
我试着使用
UseFileServer
设置
DefaultFileNames
path="." inheritInChildApplications=false"
而不是
path="default.aspx"
,但这会导致“Config section'system.web/authorization'ready defined”异常,可能是因为它与前面的system.web声明重叠。
我意识到有几种可能的解决办法:
-
容忍
default.aspx
在路径中:
-
使用
MapPageRoutes
-
将web.config设置为allow/account,然后使用位置路径手动禁用每个子目录
有没有办法让Microsoft Identity相信
/帐目/
在不使用上述要点中的解决方法的情况下不需要身份验证?
public void Configuration(IAppBuilder app)
{
app.UseFileServer(new FileServerOptions() {
DefaultFilesOptions = {DefaultFileNames = {"default.aspx"}}});
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/account/")
});
}
<!--/account/web.config-->
<configuration>
<system.web>
<authorization>
<allow roles="activeuser" />
<deny users="*" />
</authorization>
</system.web>
<location path="Default.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>
</configuration>