I have added a new Filter class to the ASP.NET MVC Filter folder/namespace. There was one previously there as well which Visual Studio is allowing me to find through Filter.blahblahblah, however the new one won't get referenced at all... I don't understand. Do I need to do anything else to get it to find the new filter?
using System;
using System.Web;
using System.Web.Mvc;
namespace Filters
{
public class RequiresSSL : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpRequestBase req = filterContext.HttpContext.Request;
HttpResponseBase res = filterContext.HttpContext.Response;
//Check if we're secure or not and if we're on the local box
if (!req.IsSecureConnection && !req.IsLocal)
{
var builder = new UriBuilder(req.Url)
{
Scheme = Uri.UriSchemeHttps,
Port = 443
};
res.Redirect(builder.Uri.ToString());
}
base.OnActionExecuting(filterContext);
}
}
}