Cop*_*opo 6 asp.net webforms owin asp.net-identity
如何设置具有标识和owin的Web表单应用程序以拒绝除登录之外的所有页面?
web.config中的此配置对我不起作用:
<system.web>
<authorization>
<deny users="*"/>
</authorization>
<authentication mode="None"/>
Run Code Online (Sandbox Code Playgroud)
错误消息:请求过滤模块配置为拒绝查询字符串太长的请求.
OWIN启动课程:
public void ConfigureAuth(IAppBuilder app)
{
// Configure the db context, user manager and signin manager to use a single instance per request
app.CreatePerOwinContext(ApplicationDbContext.Create);
app.CreatePerOwinContext<ApplicationUserManager>(ApplicationUserManager.Create);
app.CreatePerOwinContext<ApplicationSignInManager>(ApplicationSignInManager.Create);
// Enable the application to use a cookie to store information for the signed in user
// and to use a cookie to temporarily store information about a user logging in with a third party login provider
// Configure the sign in cookie
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
Provider = new CookieAuthenticationProvider
{
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, Usuario>(
validateInterval: TimeSpan.FromMinutes(0),
regenerateIdentity: (manager, user) => manager.GenerateUserIdentityAsync(user))
}
});
Run Code Online (Sandbox Code Playgroud)
项目结构

编辑:
在帐户文件夹中的web.config上有此配置.
<configuration>
<location path="Manage.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这适用于Manage.aspx页面.
我不想为每一页都这样做.我想放入该网站的全球web.config.
| 归档时间: |
|
| 查看次数: |
2795 次 |
| 最近记录: |