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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:07:05+00:00 2026-05-17T23:07:05+00:00

Initially this demo application I’m working on had just one page with a simple

  • 0

Initially this demo application I’m working on had just one page with a simple form to login

<form action="/Login/AuthenticateUser" method="post">
        <label for="username_or_email">Username or email</label>
        <input id="handle" name="handle" type="text" value="">
        <label for="password">Password</label>
        <input id="pass" name="pass" type="password" value="">
</form>

And 2 routes defined

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

            routes.MapRoute(
                "User",
                "{controller}/{handle}",
                new { Controller = "User", action = "Index", handle = UrlParameter.Optional }
            );

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Post", action = "Index", id = UrlParameter.Optional }
            );
        }

This was working without issue and has the following controller method associated

[HttpPost]
public ActionResult AuthenticateUser(FormCollection collection)
{
    //some code here ...

    return View("Index");
}

Later it was decided that I needed a route to view user information directly so I wanted something like http://localhost/User/handle

So I crafted a route and I can view this without issue. But the next time I attempted to login with the original form (above) it never hits the http post method in my controller (but instead the http get “Index” method). also to note – after this post occurs the url in the browser appears to be correct, in this case showing http://localhost/Login/AuthenticateUser.

Strange behavior undoubtedly related to the new route. Also to note – I don’t have a route defined for this auth user method.

Any way I can have these work together? In addition what caused this strange behavior? Is the route itself not correct?

Thank you in advance

  • 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-17T23:07:06+00:00Added an answer on May 17, 2026 at 11:07 pm

    The following route:

    routes.MapRoute(
                    "User",
                    "{controller}/{handle}",
                    new { Controller = "User", action = "Index", handle = UrlParameter.Optional }
                );
    

    Is routing all your requests to the Index action by default. You have not allowed for overriding the action route value, only the handle route value. So /Login/AuthenticateUser takes you to the Index action of Login controller with handle as AuthenticateUser. The route below it will never be used because {controller}/{handle} covers pretty much all requests.

    I’m not sure why it worked the first time, but it should have never worked. Could be that you didn’t build the application after you added the route I quoted above.

    Update:

    If you want to use something as general as {controller}/{string}, you’ll need to make sure that no other routes conflict with it and still have all other controllers/actions route properly. I would recommend against using something as general as {controller}/{string}, but one way around that is if you make your general routes look like this:

    routes.MapRoute(
             "User",
              "Page/{controller}/{action}",
              new { controller = "User", action = "Index" }
    );
    

    And place this above the {controller}/{string}. Again, having a very general route map to something very specific can cause a headache in the future.

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

Sidebar

Related Questions

Initially I had designed this flash based navigation menu for my website, after going
I am using VS2010 and am working with this project. http://www.codeproject.com/KB/audio-video/Asio_Net.aspx Initially, I downloaded
I initially asked this on Superuser, but somebody advised me to repost here. I
Initially I thought this was going to work, but now I understand it won't
I did something like this to initially hide the body scrollbar, and then show
EDIT: This question was initially too general, I think. So What I really need
This question was initially misphrased, see the EDIT below. I'll leave it up for
This question was initially posted on Google Moderator for the AndroidDev Office Hours Hangout
Warning: This is inherited legacy code that was initially put together in the early
I have this jQuery datepicker code that initially set the minDate of the datepicker.

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.