title: How to create a custom attribute that will redirect to Login if it returns false, similar to the Authorize attribute - ASP.NET MVC
body: <p>I tried Googling a few things about custom attributes but I'm still not sure how to go about it....</p>
  
  <p>I'm storing a few important details of the user in Session cookies (ex UserID) once the user log's in.. and all I want to do is create an attribute where if the </p>
  
  <p><code>if (Session["UserID"] == null)</code></p>
  
  <p>then it will redirect to login just like the [Authorize] attribute does.  That way I can apply this attribute on the Controller level everywhere.</p>
  
  <p>Should I overwrite the Authorize attribute?  Create a new one?  How do I get it to redirect to login as well?  </p>
  
  <p>I'm also using ASP.NET MVC 4</p>
  
  <p>Thanks for any help</p>