0
내가 세션은 로그인 페이지로 만료 된 사용자를 리디렉션하려고 해요 리디렉션되지 않습니다ASP.NET MVC 사용자 지정 작업 필터는 다음과 같은 작업 필터를 사용하여,
public class SessaoFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
string controllerName = filterContext.Controller.GetType().Name;
string actionName = filterContext.ActionDescriptor.ActionName;
if (filterContext.HttpContext.Session != null)
{
if (filterContext.HttpContext.Session["Autenticado"] == null)
{
if (!controllerName.Equals(typeof(LoginController).Name, StringComparison.InvariantCultureIgnoreCase)
|| (!actionName.Equals("Login", StringComparison.InvariantCultureIgnoreCase)
&& !actionName.Equals("Autenticar", StringComparison.InvariantCultureIgnoreCase)))
{
filterContext.Result =
new RedirectToRouteResult(
new RouteValueDictionary{
{ "controller", "Login" },
{ "action", "Login" }
});
}
}
}
base.OnActionExecuting(filterContext);
}
}
때 base.OnActionExecuting (filterContext) 처리, 파이어 폭스 브라우저는 이러한 응답을 수신하고 로그인 페이지로 리디렉션하지 :
GET (address)/Login/OpenChangePassword?_=1399920034730 200 OK 140ms jquery-1.7.1.js (line 8102) --> **The action that a Tried to call**
GET (address)/Scripts/jquery-1.7.1.js?_=1399920034951 200 OK 8ms jquery-1.7.1.js (line 8102)
GET (address)/maskedinput-1.1.2.pack.js?_=1399920035043 200 OK 3ms jquery-1.7.1.js (line 8102)
Password fields present on an insecure (http://) page. This is a security risk that allows user login credentials to be stolen. 0
Password fields present in a form with an insecure (http://) form action. This is a security risk that allows user login credentials to be stolen. 0
GET (address)/Scripts/jquery.dataTables.js?_=1399920035078 200 OK 7ms jquery-1.7.1.js (line 8102)
GET (address)/Scripts/select2.js?_=1399920035155 200 OK 14ms jquery-1.7.1.js (line 8102)
GET (address)/Scripts/select2_locale_pt-BR.js?_=1399920035213 200 OK 2ms jquery-1.7.1.js (line 8102)
GET (link)/Scripts/jquery-ui-1.8.20.js?_=1399920035238 200 OK 6ms jquery-1.7.1.js (line 8102)
GET (address)/Scripts/jquery.unobtrusive-ajax.js?_=1399920035339 200 OK 4ms jquery-1.7.1.js (line 8102)
GET (address)/Scripts/jquery.validate.js?_=1399920035368 200 OK 4ms jquery-1.7.1.js (line 8102)
GET (link)/Scripts/jquery.validate.unobtrusive.js?_=1399920035399 200 OK 2ms
이 .js
파일은 내가 로그인 페이지로 렌더링 된 파일입니다.
누군가 도움이 되십니까?
내가 AuthorizeAttribute에서 파생되는 필터를 추천하고 AuthorizeCore 메소드를 오버라이드 (override) 할이 시나리오의 TKS
감사합니다. @Matthias. AuthorizeAttribute는 실제로 정상적으로 작동했습니다. – Victor