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 6153773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T20:08:55+00:00 2026-05-23T20:08:55+00:00

How do I distinguish between these 2 routes in my area registration? These are

  • 0

How do I distinguish between these 2 routes in my area registration?

These are the last 2 routes in that area registration.

The first route is when the view is loaded. Works fine.

First route loads a form which then get posted to the same controller but different action.

I never get OK from controller. It might not hitting controller due to routing issue.

What I am missing?

    context.MapRoute(
        "Load",
        "app/respond/{Id}",
        new { controller = "Controller1", action = "Index" }
    );

    context.MapRoute(
        "Update",
        "app/respond/{action}",
        new { controller = "Controller1", action = "Update" }
    );

This is how the form looks:

@using (Html.BeginForm("Update", "Respond", FormMethod.Post, new { id = "frmUpdate" }))
{
   //all form fields go here
}

This is how the posting is done:

$('#frmUpdate').submit(function () {
    //verify all field values

    $.ajax({
        url: this.action,
        type: this.method,
        data: $(this).serialize(),
        success: function (result) {
            if (result.s == 'OK')
                alert("Success! Response updated");
            else
                alert("Sorry! Update failed.");//this is what I get
        }
    });

    return false;
});

My Controller:

[HttpPost]
public ActionResult Update(MyModel model)
{
    return Json(new { s = "OK", m = "Hi from 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-23T20:08:56+00:00Added an answer on May 23, 2026 at 8:08 pm

    You can’t distinguish between those 2 routes because they follow absolutely the same url pattern app/respond/something. You didn’t put any constraint on something so the first route will always match.

    If you want to have any chance of the routing system being able of distinguishing you need to use a constraint, for example let’s say that an {id} must contain only numbers:

    context.MapRoute(
        "Load",
        "app/respond/{id}",
        new { controller = "Controller1", action = "Index" },
        new { id = @"[0-9]+" }
    );
    
    context.MapRoute(
        "Update",
        "app/respond/{action}",
        new { controller = "Controller1", action = "Update" }
    );
    

    Now when you request app/respond/123 the Index action will be called and when you invoke app/respond/FooBar the FooBar action will be called. And if you request app/respond the Update action will be invoked.

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

Sidebar

Related Questions

I'm trying to find a CSS selector that can help me distinguish between the
What is the difference between DependsOnTargets and AfterTargets ? I can not distinguish these
I wonder if someone can distinguish precisely between these? For my understanding, Core Graphics
I have noticed that there is an asymmetry between the signature used to distinguish
How can I distinguish between published OSGI services implementing same interface by their properties?
Let's say I have a button.. how can I distinguish between single click and
Suppose my input is ( a , b and c to distinguish between equal
Can I distinguish signal, between delivered directly to a process and delivered via debugger.
Is that possible to distinguish if merge was performed manually or automatically? I'm using
As I've understood it, Esper is built using Queries to distinguish between what's relevant

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.