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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T17:54:44+00:00 2026-05-28T17:54:44+00:00

If I have a simple controller routed as follows: context.MapRoute( Default, {controller}/{action}, new {

  • 0

If I have a simple controller routed as follows:

context.MapRoute(
            "Default",
            "{controller}/{action}",
            new { controller = "Base", action = "Foo"}
        );

And the controller Foo action is as follows:

[HttpPost]
public ActionResult Foo(object bar) { ... }

How will bar be bound? I have debugged and see it is a string, but I’m not sure if it will always be marshalled to a string.

Basically I want to have the method accept a bool, List<int>, and int. I can send up a type parameter and do the model binding myself from the post. (The post is a form post).

Here are my current posts &bar=False or &bar=23 or &bar[0]=24&bar[1]=22.

I know I can look at the post inside the Foo action method, but I want some input on the best way to handle this in MVC3

  • 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-28T17:54:46+00:00Added an answer on May 28, 2026 at 5:54 pm

    In this case I would probably create a custom ModelBinder:

    http://buildstarted.com/2010/09/12/custom-model-binders-in-mvc-3-with-imodelbinder/

    then maybe use a dynamic object to allow for multiple types. See here

    MVC3 ModelBinder for DynamicObject

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

Sidebar

Related Questions

I have simple controller: public class TestController : Controller { public ActionResult Test(string r)
I have a simple controller which returns images: public class ImageController : Controller {
My question is as follows: I have a base controller (ASP.Net MVC controller) called
In my Rails application I have a simple controller which also has an action
I have a simple unsubscribe function in my Unsubscribed controller. if ($this->Unsubscribe->save($this->data['Unsubscribes'])) { //
I have a simple form in python + pylons that submits to a controller.
I have a simple UserControl for database paging, that uses a controller to perform
The question is quite simple : I have a controller plugin for Zend Framework.
A simple question: I have a Model-View-Controller setup, with Models accessing a SQL database.
So we have a real-estate-related site that has controller/action pairs like homes/view, realtors/edit, and

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.