views:

100

answers:

1

We are launching a new web site using a sub-domain and need to ensure that users logging in to the original (main domain) site, are also authenticated in the new site.

I believe I need to ensure all related web.config settings (forms authentication, cookie names etc) are the same in both applications and also manually set the machineKey validationKey/decryptionKeys (again, the same in both apps).

My question is, if I now manually set theses keys in my main app, will it break the existing logins?

We are using the "hashed" format for passwords.

+1  A: 

Depends what you mean by "break". If you modify the machineKeys/encryptiong keys people might have to log back in but the login functionality will continue to work as before.

You also need to make sure that the domain for your cookie are set to domain.com in both places (without the www) or the authentication cookies will not be shard correctly between the sites.

Chris Pebble
to complement this response, the cookie domain is set on the <form> element in web.config: http://msdn.microsoft.com/en-us/library/1d3t3c61.aspx. Note that this won't work if you have other sites which require different authentication on the same domain also running asp.net.
zcrar70
My initial concern was that changing the validation/decryption keys could somehow corrupt (or render unusable) the hashed passwords stored in the database. This (happily) is not the case, and the approach mentioned above works perfectly. Thanks.
jonhilt