tags:

views:

17

answers:

1

Hi

I am making an action filter to do a check and see if a user still has a valid key. I am just wondering what is in the base.OnActionExecuting(filterContext);?

Like do I need to call it?

Also where can I download the source for mvc 2.0? I know you could do it with 1.0 but I forgot where the files are.

+1  A: 

Chobo2, you would only call the base if there are other actions, within the frame work, that might impact on the outcome of your method.

Take this;

    public bool Overide { get; set; }

    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (!this.Overide)
        {
            filterContext.Result = new RedirectResult("/Home/Index");
        }
    }

Clearly this code does not need to call base as all the code required to make the decision is contained within my method. If however, I was to set something in the framework that might affect execution then I'd call the base and let it decide.

I think the 90/10 rule would be that you wouldn't call base.

As for MVC 2 download

griegs