[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class SampleRequireSSL : RequireHttpsAttribute
{
public override void OnAuthorization(AuthorizationContext filterContext)
{
if (Sample.Web.Areas.Admin.Helpers.ConfigSettings.RequireSSL)
{
base.OnAuthorization(filterContext);
}
}
}
Sunday, January 30, 2011
Design an Attribute that forces an unsecured HTTP request to be sent over HTTPS in ASP.NET MVC
Labels:
Action Filter,
ASP.NET MVC,
HTTPS
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment