您好我想知道是否有可能通過使用asp.net身份asp.net身份multipe用戶登錄
對於例如有管理員登錄頁面和普通用戶,這對於在同一Web應用程序兩個差網站的多個登錄頁面登錄頁面。一旦用戶已經登錄到管理員。用戶還允許在不註銷管理站點的情況下再次登錄到普通用戶頁面。順便說一句會有兩個區別的用戶名
有沒有人有任何想法如何做到這一點?這是對asp.net身份的限制,只允許整個asp.net中的一個登錄頁面?
感謝,
您好我想知道是否有可能通過使用asp.net身份asp.net身份multipe用戶登錄
對於例如有管理員登錄頁面和普通用戶,這對於在同一Web應用程序兩個差網站的多個登錄頁面登錄頁面。一旦用戶已經登錄到管理員。用戶還允許在不註銷管理站點的情況下再次登錄到普通用戶頁面。順便說一句會有兩個區別的用戶名
有沒有人有任何想法如何做到這一點?這是對asp.net身份的限制,只允許整個asp.net中的一個登錄頁面?
感謝,
如果你想用管理員帳戶和明年與用戶帳戶你可以與其他瀏覽器或專用模式訪問網站登錄登錄。我不知道你想做什麼,但如果它只是爲了測試,你可以做到這一點。
晚了,但可能會幫助別人。據Pinpoint Answer上類似的問題,你可以做這樣的事情在啓動類定製:
using System;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
using Microsoft.AspNet.Identity;
public partial class Startup {
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
// Basic for site guest
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login"),
LogoutPath = new PathString("/Account/Logout"),
Provider = new CookieAuthenticationProvider {
OnApplyRedirect = RedirectIfAdmin,
OnValidateIdentity = SecurityStampValidator.OnValidateIdentity<ApplicationUserManager, ApplicationUser>(
validateInterval: TimeSpan.FromMinutes(30),
regenerateIdentity: (manager, user) => user.GenerateUserIdentityAsync(manager))
}
});
}
private static void RedirectIfAdmin(CookieApplyRedirectContext context)
{
// If Url contains
Uri absoluteUri;
if (Uri.TryCreate(context.RedirectUri, UriKind.Absolute, out absoluteUri))
{
string path = context.Request.PathBase + context.Request.Path + context.Request.QueryString;
if (path.Contains("/administration")) {
context.RedirectUri = "/administration/login.aspx" +
new QueryString(context.Options.ReturnUrlParameter, context.Request.Uri.AbsoluteUri);
}
}
context.Response.Redirect(context.RedirectUri);
}
謝謝,我會尋找它 – user998405