Form authentication via ASP.NET subdomain
This question is similar to this one: Asp.net profile via subdomain
I'm mainly wondering if a user logs in via "www.yourdomain.com", is it possible that "subdomain.yourdomain.com" will also recognize them as logged in by checking their AuthCookie?
The answer to the above question is to put: domain="yourdomain.com"
in your web.config.
My question is, how do I set this up to work locally when your domain is localhost? Are you just using the domain in your local / dev environment?
Any help with this would be much appreciated.
Thank!
source to share
I actually just coded something like this in the last hour. I used httpCookies in the Web.config, although setting the domain on the forms authentication tag also works.
This is what I have set in web.config:
<httpCookies domain="thedomain.com" />
This is what I added to my hosts file:
127.0.0.1 local.thedomain.com
Then when I access the site in my dev block I go through:
http://local.thedomain.com
source to share
Well, localhost is just the local DNS entry for 127.0.0.1.
If you edit the file c: \ windows \ system32 \ drivers \ etc \ hosts, you can add other entries to match your live environment (but obviously, this will mean that all requests for these domains will be your local machine , not real servers).
If you're talking about managing configurations across different deployments of your application (local, dev, release), you need to look at doing some post-build tasks.
source to share