This is part of my configuration file.
<authentication mode="Forms"> <forms loginUrl="~/Account/Login" timeout="2880" enableCrossAppRedirects="true" name="authtoken" domain="localsite.com" /> </authentication>
This is my authentication method.
public void Authenticate(string token, int userId) { var userData = new FormTicketUserData() {UserId = userId}; var ticket = new FormsAuthenticationTicket(1, token, DateTime.Now, DateTime.MaxValue, false, userData.ToString()); var encryptString = FormsAuthentication.Encrypt(ticket); var authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptString); authCookie.Path = FormsAuthentication.FormsCookiePath; HttpContext.Current.Response.Cookies.Remove(FormsAuthentication.FormsCookieName); HttpContext.Current.Response.Cookies.Add(authCookie); HttpContext.Current.User = new MyFormsPrincipal(new FormsIdentity(ticket), userId); UserContext.Refresh(); }
When I authenticate to www.localsite.com, I do not authenticate to localsite.com and vice versa.
When I authenticate to www.localsite.com, I also need to authenticate to localsite.com.
How can i do this.
source share