표준 HTML 양식에서 정상적으로 작동하는 내 .Net MVC 응용 프로그램의 만료 된 세션을 확인하는 고객 필터 속성이 있습니다. 그러나 Ajax 폼에 의해 호출 된 액션에 속성을 적용하고 세션이 만료되면 로그인 페이지 (필터 속성이 컨텍스트를 리디렉션하는 위치)를 Ajax 업데이트 컨테이너로 다시로드합니다. 누군가가 ajax 호출이 만료 될 때 세션이 만료되거나 누구든지이 상황을 좀 더 우아하게 처리하는 방법을 알고 있다면 로그인 페이지로 리디렉션하는 전체 페이지를 가져 오는 방법을 알고 있습니까? 미리 감사드립니다..net mvc & ajax forms - 세션 만료 처리 방법
public class SessionExpiredFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpContext ctx = HttpContext.Current;
// check if session is supported
if (ctx.Session != null)
{
// check if a new session id was generated
if (ctx.Session.IsNewSession)
{
// If it says it is a new session, but an existing cookie exists, then it must
// have timed out
string sessionCookie = ctx.Request.Headers["Cookie"];
if ((null != sessionCookie) && (sessionCookie.IndexOf("ASP.NET_SessionId") >= 0))
{
//SessionHelper.AddPageMessage("message", "Your session has expired. Please login to continue");
ctx.Response.Redirect("~/Account/Logon");
}
}
}
base.OnActionExecuting(filterContext);
}
}
나는 이것에 대한 답변을 찾고 있습니다. – CedricB