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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:35:48+00:00 2026-05-23T13:35:48+00:00

For some reason, whenever I try to resolve a URL with arguments in my

  • 0

For some reason, whenever I try to resolve a URL with arguments in my local installation of ASP.NET MVC3, the arguments basically end up being null in my controller’s handling function.

For example, I have

public class HomeController : Controller 
{
    public ActionResult Foo(string bar)
    {
        ViewBag.Message = bar;
        return View();
    }
}

and try to visit http://localhost/myapp/foo/sometext or http://localhost/myapp/home/foo/sometext, bar basically evaluates to null instead of sometext.

I’m fairly confident that my MVC3 install is working properly, as I’ve managed to run a separate app with a custom routing rule just a few days back. I’m kind of wary that I might have botched up a config flag somewhere or whatever.

Any ideas on what could be wrong here?

  • 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-23T13:35:48+00:00Added an answer on May 23, 2026 at 1:35 pm

    The default route mapping expects a parameter named id in your action.

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

    If you change your action to this:

    public ActionResult Foo(string id)
    

    it should work. You could also try a URL like this if changing the parameter name isn’t possible:

    http://localhost/myapp/home/foo/?bar=sometext
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to test out html5 localStorage feature. For some reason, whenever I try
For some reason, whenever I now try and run my SL4 application out-of-browser, when
for some reason whenever i try to spawn a server with rubber it gets
for some reason, whenever I dynamically load a swf on a $(document).ready() by writing
For some reason, whenever I scroll through my list of items, the background inside
Background: For some reason, whenever a user tries to open an xslx (excel 2007)
For some reason when I attempt to make a request to an Ajax.net web
For some reason, when I try to install SQL Server 2008 Express , I
For some reason whenever i run a query on the db cursor, it generates
For some reason whenever I do an async request using YUI and specify it

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.