Forms Auth: have different credentials for a subdirectory?

Posted by Fyodor Soikin on Stack Overflow See other posts from Stack Overflow or by Fyodor Soikin
Published on 2010-03-16T03:36:30Z Indexed on 2010/03/16 5:16 UTC
Read the original article Hit count: 373

Filed under:
|
|
|

My website has forms authentication, and all is well. Now I want to create a subdirectory and have it also password-protected, but! I need the subdirectory to use a completely different set of logins/passwords than the whole website uses.

Say, for example, I have users for the website stored in the "Users" table in a database. But for the subdirectory, I want the users to be taken from the "SubdirUsers" table. Which probably has a completely different structure.

Consequently, I need the logins to be completely parallel, as in:

  1. Logging into the whole website does not make you logged into the subdirectory as well
  2. Clicking "logout" on the whole website does not nullify your login in the subdirectory
  3. And vice versa

I do not want to create a separate virtual application for the subdirectory, because I want to share all libraries, user controls, as well as application state and cache. In other words, it has to be the same application.

I also do not want to just add a flag to the "Users" table indicating whether this is a whole website user or the subdirectory user. User lists have to come from different sources.

For now, the only option that I see is to roll my own Forms Auth for the subdirectory.

Anybody can propose a better alternative?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about ASP.NET