views:

72

answers:

2

I'm building three web applications in .NET that will all share a users database and login information. Lets pretend that application 1 is the "parent" application and applications "A" and "B" are the "child" applications. All users have to be logged into application 1 to have access to applications A and B.

Authorization, Authentication, and MachineKey sections of all web configs are present and work correctly.

I have the correct web.config settings in all applications to achieve Single Sign On except one problem remains: what do I put in the "loginUrl" attribute of the forms tag in Applications A and B.

Assume that the url for the login to application 1 is "www.johnsapp.com/login.aspx" How can I get applications A and B to send the user back to application 1 for authentication using only settings in web.config?

A: 

How about using Windows authentication?

Raj More
The applications are being used by external users, therefore Windows authentication is not an option. Thanks for the reply!
John H.
+1  A: 

You could use

if (!Request.IsAuthenticated)
    Response.Redirect("~/Login.aspx?ReturnUrl=~/thisurl");

in the Page_Load function of the codebehind. This will redirect automatically.

jawonlee
I've thought about doing this, but it seems a little kludgey. I'm wondering if there is a solution that can be implement in the web.config files of applications A and B
John H.
This answers the question as stated, might want to update the question with specific request for web.config solution.
mwright