Wie richte ich eine Web Forms Anwendung mit Identität ein und lege dazu alle Seiten mit Ausnahme der Anmeldung ab?Verweigern Sie alle Seiten ohne Anmeldung auf Asp.net Web Forms mit Identity Framework und Owin
Diese Konfiguration in web.config nicht für mich arbeiten:
<system.web>
<authorization>
<deny users="*"/>
</authorization>
<authentication mode="None"/>
Fehlermeldung: Das Anforderungsfilterungsmodul ist konfiguriert, um eine Anfrage zu verweigern, wenn die Abfrage-Zeichenfolge zu lang ist.
OWIN Startklasse:
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))
}
});
Projektstruktur
Edit:
Auf web.config innerhalb Konto Ordner gibt es diese Konfiguration.
<configuration>
<location path="Manage.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</configuration>
Dies funktioniert für Manage.aspx Seite.
Ich möchte das nicht für jede Seite tun. Ich möchte die globale web.config der Website einfügen.
2016 ... Ist immer noch ein Fehler ... Ihr Link scheint kaputt zu sein. – RokumDev