首页 新闻 赞助 找找看

asp.net mvc 4 二级域名身份验证为空

0
[待解决问题]

在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 可以正常获取,但身份验证的就不行

晴朗星空2012的主页 晴朗星空2012 | 菜鸟二级 | 园豆:202
提问于:2016-09-18 00:33
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册