I have a mobile version web application of my website with domain, main website http开发者_JAVA百科://hello.world.com mobile website http://m.hello.world.com
if the user logs into my mobile website and user visits main web application he should be logged into the main website as well and viceversa. i am setting login cokkies.
i tried to set the path like:
HttpCookie cookie = FormsAuthentication.GetAuthCookie(userName, isPersistent);
cookie.Path = "/";
but didn't work. Let me know how can i solve this.
You can share cookies across subdomains, by using this technique
ASP.NET Subdomain Cookie (parent and one subdomain)
Effectively you need to add
cookie.Domain = ".world.com";
Response.Cookies.Add(cookie)
Then you create a cookie it's, by default, is associated with current domain i.e. hello.world.com
and m.hello.world.com
and retrieved also, by domain. You should look into setting Domain property of a cookie the you create and read them.
精彩评论