I am getting Too many redirects error in my MVC application.
After i add UserFilter : ActionFilterAttribute how can i solve this problem ?
- public class UserFilter : ActionFilterAttribute
- {
- public override void OnActionExecuting(ActionExecutingContext context)
- {
- int? userid = context.HttpContext.Session.GetInt32("id");
- if (!userid.HasValue)
- {
- context.Result = new RedirectToRouteResult(
- new RouteValueDictionary
- {
- {"action","Index"},
- {"controller","Admin"}
- }
- );
- }
- }
- }

Sachin SinghRank #66 · 26.2K reputationPosted Jun 2, 2021, 8:09 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 2, 2021, 8:17 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 2, 2021, 9:06 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 2, 2021, 9:39 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 3, 2021, 3:51 AM EDT
Uygar Kılıç24 reputationPosted Jun 2, 2021, 8:14 AM EDT
Uygar Kılıç24 reputationPosted Jun 2, 2021, 8:59 AM EDT
Uygar Kılıç24 reputationPosted Jun 2, 2021, 9:33 AM EDT
Uygar Kılıç24 reputationPosted Jun 3, 2021, 3:29 AM EDT
Uygar Kılıç24 reputationPosted Jun 4, 2021, 5:26 AM EDT