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

  • SEARCH
  • Home
  • 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 7741531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:03:23+00:00 2026-06-01T09:03:23+00:00

This is NOT a duplicate question, and the problem is driving me crazy. I

  • 0

This is NOT a duplicate question, and the problem is driving me crazy. I am getting the typical error “A public action method X was not found on controller Y” which returns a 404 Not Found. The screenshot gives you a good idea:

Visual Studio debugging session

The image shows the debugger paused right before the line that throws the exception is executed (base.HandleUnknownAction(actionName)). Now, before you jump into conclusions, here’s some info:

  1. This was working at some point perfectly well.
  2. The HTTP verb (GET) should be accepted by the UpdateCart action (see annotations above method signature).
  3. The parameters sent are irrelevant: the error happens with POST, GET and any combination of parameters.
  4. Other similar actions in the same controller work well.
  5. I took the screenshot with UpdateCart marked virtual, but removing virtual makes no difference.
  6. The screenshot shows that ActionInvoker.InvokeAction(this.ControllerContext, "UpdateCart") returns false. Not sure why the reflection performed over my controller can’t find the method, but it’s RIGHT THERE!!

The routes are the default ones and they work, since otherwise I wouldn’t have been able to stop the debugger to take the screenshot above. Here’s the code from Global.asax.cs:

public static void RegisterRoutes(RouteCollection routes)
{
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Tickets", action = "Index", id = UrlParameter.Optional } 
    );

}

Any ideas are greatly appreciated.

EDIT

Ethan Brown’s answer below is correct: HttpGet and HttpPost are mutually exclusive. The solution was to replace these attributes with [AcceptVerbs(HttpVerbs.Get | HttpVerbs.Post)].

  • 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-06-01T09:03:24+00:00Added an answer on June 1, 2026 at 9:03 am

    The problem is that you’re specifying both the HttpGet and HttpPost attributes. If you leave both of them off, the action accepts both POST and GET requests. My guess is that the HttpGet and HttpPost attributes don’t signal to MVC to allow the corresponding request type, but to deny the opposite type. So by including [HttpPost], you’re denying GET requests, and by including [HttpGet], you’re denying POST requests…effectively denying all request types. Leave the attributes off and it will accept both types.

    Update: I just checked the MVC source, and my assumption is correct. In ActionMethodSelector, it checks the attributes thusly:

    if (attrs.All(attr => attr.IsValidForRequest(controllerContext, methodInfo))) {
        matchesWithSelectionAttributes.Add(methodInfo);
    }
    

    In other words, all ActionMethodSelectorAttribute (from which HttpPostAttribute and HttpGetAttribute derive) must return true for the action to be invoked. One or the other is always going to return false, so the action will never execute.

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

Sidebar

Related Questions

I hope this question is not a duplicate but I didn't find anything equivalent
Ok this is not duplicate of Alternative to Process.Start() because my question is something
Title borrowed from this question , of which this one is not a duplicate.
Possible Duplicate: Need help solving Project Euler problem 200 Similar to this question Project
This question is not a duplicate of Get data file from microphone in windows
Perhaps this is a duplicate question, but I havn't found something by myself. Basically
Firstly I feel this question is not a duplicate for : Easiest implementation of
I am having a problem with the following query(if this is a duplicate question
First off, this is NOT a duplicate of: Turn a C string with NULL
Possible Duplicate: Comparing Strings in Cocoa Why is this code not recognising the NSString

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.