0

I am looking to implement Simple Membership authentication for a wildcarded sub-domain application. Users will login to a root site (i.e. www.localhost.com) and be redirected to a psuedo sub-domain site (www.user1.localhost.com). There is only one application on the server.

The following web.config entry for authentication is not working:

<authentication mode="Forms">
  <forms loginUrl="~/Account/SignIn" timeout="2880" domain=".localhost" />
</authentication>

The above entry will not authenticate users into the root site or any of the user specific sites. My local hosts file is configured correctly.

Is this authentication scheme possible with Simple Membership? Am I missing a step?

njebert
  • 534
  • 4
  • 14

1 Answers1

2

Whether you are using SMP or the standard membership provider has nothing to do with the FormsAuthentication process and the cookie transmission and decryption.

In addition to setting the domain property to your top level domain make sure that you have configured the same machine keys on both applications.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • I am only authenticating against one application. The application will be set up with a wildcard DNS entry to pass all traffic, fake sub-domain or otherwise, to the same application. Do I still need to configure the machine key? – njebert Oct 08 '12 at 14:51
  • No, if it is the same application you don't need to configure the machine keys. Use FireBug to see if the authentication cookie is sent for subsequent requests. – Darin Dimitrov Oct 08 '12 at 14:54
  • The .ASPXAUTH cookie is sent for subsequent requests to localhost.com after authentication. The cookie is not sent when trying to navigate to sample.localhost.com after authentication on localhost.com. – njebert Oct 08 '12 at 15:48
  • Could you try using some domain name different than `localhost`? – Darin Dimitrov Oct 08 '12 at 15:49
  • 1
    Switching from localhost to ..com worked. I updated the domain attribute in the web.config authentication/forms section to domain="...com" and authentication is working correctly for the top level domain and the sub-domains. Thanks for all your help! – njebert Oct 08 '12 at 16:08
  • For future reference, this MSDN article explains this well - http://msdn.microsoft.com/en-us/library/eb0zx8fc(v=vs.100).aspx – Deano Nov 20 '13 at 15:41