10

Before RC1 we did something like this:

public void OnAuthorization(AuthorizationContext filterContext)
    {
        if (whatever)
        {
            filterContext.Cancel();
        }
    }

This is gone now, how do we achieve the same results with RC1?

Thanks,

Kyle

1 Answer 1

17

Instead of a Cancel property you just need to set the ActionResult to a different result. So for the Cancel property, you just have to replace your Cancel=true with

filterContext.Result = new HttpUnauthorizedResult();

REFERENCE

Breaking Changes for RC1:

AuthorizationContext - no longer has a Cancel property

UpdateModel - no longer accepts a FormCollection

UrlHelper - no longer accepts a ViewContext

Scotts Blog with the White Papers of RC1 changes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.