0
로그인 컨트롤러에 이와 같은 코드가 있습니다. 나는 사용자가 올바른 사용자 이름과 암호로 로그인 할 때 쿠키와 세션을 만듭니다.몇 분이 지나면 쿠키가 만료됩니까? 시간 초과가 제대로 작동하지 않습니다.
Models.DTO.Security.CustomPrincipalSerializeModel serializeModel = new Models.DTO.Security.CustomPrincipalSerializeModel();
serializeModel.Id = member.Id;
serializeModel.UserName = member.UserName;
serializeModel.RoleId = member.RoleId;
serializeModel.IsAdmin = member.IsAdmin;
JavaScriptSerializer serializer = new JavaScriptSerializer();
string userData = serializer.Serialize(serializeModel);
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
1,
model.UserName,
DateTime.Now,
DateTime.Now.AddMinutes(60),
false,
userData
);
string encTicket = FormsAuthentication.Encrypt(authTicket);
HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)
{
HttpOnly = true
};
Response.Cookies.Add(faCookie);
Session["CartItemsCount"] = 0;
Session["CartItems"] = new List<Models.DTO.CartDTO.CartVM>();
Session["DiscountPercentage"] = member.DiscountPercentage;
Session["CreditLimit"] = member.CreditLimit;
는 그리고 난 다음의 Web.config 있습니다
<system.web>
<sessionState timeout="60"/>
<authentication mode="Forms">
<forms loginUrl="~/Home/Index" timeout="60" name=".ASPXAUTH" />
</authentication>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
내가 어디에서나 60 분 만료 시간 제한을 설정합니다. 모든 것이 옳은 것처럼 보입니다. 그리고 로컬 서버에는 문제가 없습니다. 그러나이 프로젝트를 서버에 게시 할 때 시스템이 5 분 동안 사용하지 않으면 홈/색인 (로그인 페이지)으로 사용자를 리디렉션합니다.
이유를 알 수 없습니다. 제가 누락 된 것이 있습니까?
컴퓨터 키와 관련된 문제 일 수 있습니까? 이 문제를 어떻게 해결할 수 있습니까?