简体   繁体   中英

Multiple Forms Authentication scenarios on the same website?

I will soon be starting on a new web project that consists of 2 main areas.

  • Forums / Community
  • Recruitment

Until now, I've always used straightforward Forms Authentication on my community websites, and that one method of authentication, with that one cookie/ticket has been used throughout the website (with varying roles per user also stored in the ticket). I haven't used the built in LogIn controls and instead have always just created my own login/registration form, and written the code to insert into (and authenticate against in the log-in scenario) my bespoke 'Users' table. So I've essentially just been utilizing the .IsAuthenticated() method (to determine if a user is logged in), referenced the UserData property in the ticket (to determine which roles the user belongs to), and set up the 'location' restrictions in the Web.config, so the log-in page is automatically shown for pages that require 'member access' etc.

With my new project, I will need user registration/login for the Forums/Community part of the website only. I then need an additional user registration/login for the Recruitment part of the website (not related in any way to the users that sign up/log in to the Forums/Community part of the site).

I was wondering if this possible, and if so, how to go about it?

The user registration/sign-in pages might look the same, but my underlying code would would create accounts/authenticate against different DB tables.

You could to create two different classes which inherits from MembershipProvider , each one with your specific database logic and connection string.

BTW, creating two groups isn't enough for your scenario? Would be weird if I needed two different credentials to log in into two different areas from same website.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM