在user.a.com中有如下代码做用户登陆:
var __doubleTimeOut = FormsAuthentication.Timeout.TotalMinutes;
string __strJson = Beicity.Utility.JsonHelper.JsonSerializer(loginModel);
FormsAuthenticationTicket __authTicket = new FormsAuthenticationTicket(1, __strJson, DateTime.Now, DateTime.Now.AddMinutes(__doubleTimeOut), false, Request.UserHostAddress);
string __encryptedTicket = FormsAuthentication.Encrypt(__authTicket);
System.Web.HttpCookie __authCookie = new System.Web.HttpCookie(FormsAuthentication.FormsCookieName);
__authCookie.Value = __encryptedTicket;
FormsAuthentication.SetAuthCookie(loginModel.UserName, false);
__authCookie.Domain = System.Configuration.ConfigurationManager.AppSettings["CookieDomain"].ToString();
__authCookie.Path = "/";
HttpCookie _testCookie = new HttpCookie("Test");
_testCookie.Value = "aaaa";
_testCookie.Domain = ".a.com";
_testCookie.Path = "/";
System.Web.HttpContext.Current.Response.Cookies.Add(__authCookie);
System.Web.HttpContext.Current.Response.Cookies.Add(_testCookie);
在test.a.com中:
Request.Cookies[FormsAuthentication.FormsCookieName]返回为null
搞了一天多了,不知道问题出在哪,_testCookie 可以正常获取,但身份验证的就不行