views:

438

answers:

2

Hi,

i'm trying to create a small intranet. For this I have a webserver on my local pc. The root of this website will be a dashboard and it will contain login/register functionality (default ASP.NET Membership).

http://localhost
http://localhost/Account

The rest of the intranet will consist of sub-applications like:

http://localhost/ApplicationName

The root website, and most of the sub-applications will be requiring authentication of the user for which I will be utilizing the default ASP.NET Membership provider.

All the projects (root and sub) are seperate projects in Visual Studio, and every project has it's own WebSetup project for deployment.

1.) How can I use ASP.NET Membership in sub-applications?

Furthermore, most of the applications (root and sub) will be using a 3rd party library (data framework).

2.) How can I reference the library in the root-project and 'use' the referenced library in sub-applications?

Thank you for any suggestions!

+2  A: 

Create your common code in class library projects that can be used from multiple web projects. As for the membership provider, I think you'll need to store the membership data in an external SQL instance (which could be on the same server) and then simply use the same connection strings to access it in each project.

tvanfosson
The common code you are referring to is the 3rd party library. This library consists of multiple dll files which are included in the /bin/ folder of every project I deploy. I want to only deploy them to the /bin folder of the root project. The sub-projects need to reference those files. Is this possible?
Ropstah
It seems the assembly needs to be registered in the GAC (Global Assembly Cache). For the Membership part your answer is the best solution.
Ropstah
@ropstah -- the only way I can think to avoid having to put the libraries in the GAC is to have your own layer that references these libraries and include it in your projects. The reference to your wrapper library should "bring along" the references to the external libraries. I'm not sure it's worth that effort.
tvanfosson
+1  A: 

Membership is designed to work with one or many applications. You can have an instance of a database (separate from any databases for any of your applications) that can house each of your applications Membership data. If you wish to have all of your applications use the same Membership data, provide an identical applicationName (and connectionString) when defining Membership in each application's web.config.

As for the second part of your question, the answer tvanfosson posted (along with the comments) should lead you on the right path.

Edit (@ ropstah Comment): Ah, I did not account for that. In that case, you'd want to implement Single Sign-on (SSO). Masoud Tabatabaei posted an article at ASPAlliance.com that walks through the process. Also, the answer provided by Keith Rull to this Stack Overflow question may help as well.

bryan_cook
I tried setting the applicationName in the web.config entries to the same application for all projects. However when logging in in the root project, I still need to login in the subproject (user/pass do work, however cookie is not persisted between applications).
Ropstah
I wish i could give you more points :-)Thanx!
Ropstah