Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 573081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:41:11+00:00 2026-05-13T13:41:11+00:00

Whatever happened to the Cancel property on the ActionExecutingContext? How would one abort a

  • 0

Whatever happened to the Cancel property on the ActionExecutingContext? How would one abort a RenderAction when using an ActionFilterAttribute or is there another way to skin this cat?

  public override void OnActionExecuting(ActionExecutingContext filterContext)
  {
   if(!filterContext.HttpContext.User.Identity.IsAuthenticated)
   {
    return;
   }
   base.OnActionExecuting(filterContext);
  }

The code above continues to execute the Action it has been applied to despite exiting the OnActionExecuting operation?

— Further To original post:
Thanks for the answers below, however, I don’t think I have made the context clear enough, I am trying to invalidate the following call:

<% Html.RenderAction("Menu", "Shared", new { id = Model.OtherUserId }); %>

When a user is not authenticated this action should return nothing, I could easily put an ‘if’ block on the view, however, I would like to keep the rule in the controller.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:41:12+00:00Added an answer on May 13, 2026 at 1:41 pm

    No, you can not cancel a rendering from a action filter. There are many reasons that you should not do that. What would the client see? A error page? Nothing?

    I guess you are building a authorize action filter that would render something else if you are not signed in. There is one in the framework already (AuthorizeAttribute) that redirects you to the login page if you are not signed in. The way that they do it in the framework is to change the result that is being executed (filterContext.Result = [[new result]];). If you don’t like how it works you can build your own implementation.

    If you still need to cancel the rendering or something like that you will need to build your own ActionResult and do whatever logic you need in the Execute method.

    — Update —

    If you want to use render action you should just put the logic in the controller and return empty result if you are not signed in (there is a action result called “EmptyResult” in the framework). That kind of logic belongs in the controller action.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to disregard whatever styles written, and start from scratch for
Given something like this: var results = theElement.Element(Blah).Element(Whatever).Elements(Something); Is there an elegant way to
Is there a way to allocate an uninitialized block of memory, such as an
I am using the whatever:hover script to mimic the :hover selector in IE6. The
How can I perform this query on whatever way: delete from sys.tables where is_ms_shipped
Is there a jquery method/whatever to toggle all checkboxes EXCEPT disabled ones? i have
I'm loading .swf files into a WebView directly using webView.loadUrl(http://whatever.com/file.swf); . It works perfectly
For whatever reason, our company has a coding guideline that states: Each class shall
For whatever reason, I have a lot of clients that have existing data that's
For whatever reason, ThreadPool 's QueueWorkItem doesn't return an IAsyncResult or some other handle

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.