Tag: ActionFilterAttribute

Redirecting MVC controller to HTTPS if required

Check out this excellent blog on how to create a simple ActionFilterAttribute that handles redirecting to https:// if required.

http://weblogs.asp.net/dwahlin/archive/2009/08/25/requiring-ssl-for-asp-net-mvc-controllers.aspx

then just decorate your whole Controller ot ActionResult method with

[RequiresSSL]
 public class AccountController : Controller
 {
 ...
 }