Skip to content

Instantly share code, notes, and snippets.

@c1982
Created February 17, 2011 03:11
Show Gist options
  • Save c1982/830882 to your computer and use it in GitHub Desktop.
Save c1982/830882 to your computer and use it in GitHub Desktop.
using System.Web.Mvc;
namespace MvcApplication1.Models
{
public class LoginRequiredAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.HttpContext.Session["isLogIn"] == null)
filterContext.Result = new RedirectResult("~/Home/Login");
base.OnActionExecuting(filterContext);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment