1
새로운 환경에서 웹 사이트를 설정하려고하는데 회원 공급자에게 문제가 있습니다.SetAuthCookie가 테스트 서버에 쿠키를 설정하지 않았습니다.
Membership.ValidateUser
을 호출 할 수 있습니다. 그러면 true 및 false가 반환됩니다. 그건 완벽합니다.
그러나 새 환경에서는 쿠키가 설정되지 않습니다. localhost 및 프로덕션 서버에서 CommunityServer
이라는 쿠키를 설정했지만 새 환경에서는 쿠키를 설정할 수 없습니다.
의 Web.config 코드 : 코드에
이<authentication mode="Forms">
<!-- development -->
<forms name=".CommunityServer" protection="All" timeout="60000" loginUrl="~/user/login" slidingExpiration="true"/>
<!-- deployment -->
<!--<forms name=".CommunityServer" domain="domain.com" protection="All" timeout="60000" loginUrl="~/user1.aspx" slidingExpiration="true" />-->
</authentication>
<authorization>
<allow users="?"/>
</authorization>
로그 : 약 힌트의
if (String.IsNullOrEmpty(UsernameLogin)) {
ModelState.AddModelError("UsernameLogin", Strings.Error_NoLoginUsernameEntered);
}
if (String.IsNullOrEmpty(PasswordLogin)) {
ModelState.AddModelError("PasswordLogin", Strings.Error_NoLoginPasswordEntered);
}
if (!Membership.ValidateUser(UsernameLogin, PasswordLogin)) {
ModelState.AddModelError("UsernameLogin", Strings.Error_LoginFailed);
}
if (!ModelState.IsValid) {
return View(new UserLoginModel() { Title = String.Format(Strings.Site_Title, Strings.UserLogin_Title) });
}
FormsAuthentication.SetAuthCookie(UsernameLogin, true);
// we know this code is run and I am being redirected to the return url
if (!String.IsNullOrEmpty(ReturnUrl)) {
return Redirect(ReturnUrl);
}
어떤 아이디어 우리의 쿠키가 설정되지 않습니다 이유는 무엇입니까? IIS 8 서버입니다.
의견에있는대로 올바른 '도메인'매개 변수를 설정하십시오. – Aristos