多窗体身份验证方案在同一个网站? [英] Multiple Forms Authentication scenarios on the same website?

查看:79
本文介绍了多窗体身份验证方案在同一个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将很快开始在一个新的Web项目,它由2个主要领域。

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

  • 论坛/社区
  • 招聘

到现在为止,我一直使用简单的表单验证我的社区网站,以及已经使用的身份验证方法之一,用一个饼干/票务整个网站(具有不同的每用户也存储在票角色) 。我没有使用内置的登录控件,而是始终只是创建了自己的登录/注册表格,并写在code插入到(并且在登录的情况验证对)我定制的用户表。所以我基本上刚刚被利用.IsAuthenticated()方法(来确定用户是否登录),引用的票的UserData属性(以确定哪些角色用户所属),并成立了位置在Web.config限制,所以对于需要成员访问等。

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?

用户注册/登录页面看起来一样,但是我根本code会会创建帐户/验证对不同的数据库表。

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

推荐答案

您可以创建,两个不同的类继承自的MembershipProvider 每一个与你的特定数据库的逻辑和连接字符串。

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.

这篇关于多窗体身份验证方案在同一个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆