views:

17

answers:

1

I have this little bit of code:

using System;
using System.Web.Mvc;

public class SecureFilter : RequireHttpsAttribute
{
    public override void OnAuthorization(AuthorizationContext filterContext)
    {
        if (null == filterContext)
        {
            throw new ArgumentNullException("filterContext");
        }

        if (null != filterContext.HttpContext && filterContext.HttpContext.Request.IsLocal)
        {
            return;
        }

        base.OnAuthorization(filterContext);
    }
}

Where I am trying to determine if the request is local or not is where I am getting the compile time exception. It gives me this error:

'System.Web.HttpContextBase' does not contain a definition for 'Request' and no extension method 'Request' accepting a first argument of type 'System.Web.HttpContextBase' could be found (are you missing a using directive or an assembly reference?)

From what I understand the Request object actually belongs to the controller, but I am not quite sure how I am supposed to create this action filter if I am not able to gain access to the object.

Any guidance here would be greatly appreciated!

A: 

This was something quirky with the project it seems. I followed Nick Riggs advice and tried a test solution and it worked just fine. So I deleted the project from my current solution and created a new one and just copied the files into it. This got it working.

joshlrogers