IIS表单身份验证是否与匿名身份验证帐户相关?

问题描述 投票:0回答:1

登录(使用表单身份验证)后访问主页时,某些资源(图像)没有出现但是,在iis管理器中将匿名身份验证的属性设置为“应用程序池ID”是可行的

IIS使用哪个Windows帐户进行表单身份验证?

asp.net forms authentication iis anonymous
1个回答
0
投票
仅登录页面需要匿名授权访问。听起来您未正确设置匿名身份验证。

当我们在IIS中实现表单身份验证时,同时启用了表单身份验证和匿名身份验证。然后,我们将为所有用户创建allow auth规则,并在站点级别拒绝匿名用户。

<authentication mode="Forms"> <forms name=".MyCookie" loginUrl="Login" protection="All" timeout="60" /> </authentication> <authorization> <deny users="?" /> <allow users="*" /> </authorization>

第二,我们需要创建一个授权规则,以允许匿名访问登录页面。

<location path="Login"> <system.web> <authorization> <allow users="*" /> </authorization> </system.web> </location>

当您通过表单身份验证时,IIS将发送带有用户名的表单身份验证cookie,该用户名由您的应用程序决定。它可以是appsetting中的密钥,也可以是数据库中的用户名。

1。

FormsAuthentication.SetAuthCookie(UserInfo.UserName, false, FormsAuthentication.FormsCookiePath);

2。

FormsAuthenticationTicket

3。

FormsAuthentication.RedirectFromLoginPage(UserInfo.UserName, false);

您需要确保auth_user和应用程序池标识具有访问映像源的权限。https://support.microsoft.com/en-us/help/301240/how-to-implement-forms-based-authentication-in-your-asp-net-applicatio
© www.soinside.com 2019 - 2024. All rights reserved.