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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:35:15+00:00 2026-05-30T16:35:15+00:00

I have an ASP.net MVC controller called Designs that has an action with the

  • 0

I have an ASP.net MVC controller called Designs that has an action with the following signature:

public ActionResult Multiple(int[] ids)

However, when I try to navigate to this action using the url:

http://localhost:54119/Designs/Multiple?ids=24041,24117

The ids parameter is always null. Is there any way to get MVC to convert the ?ids= URL query parameter into an array for the action? I’ve seen talk of using an action filter but as far as I can tell that will only work for POSTs where the array is passed in the request data rather than in the URL itself.

  • 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-30T16:35:17+00:00Added an answer on May 30, 2026 at 4:35 pm

    The default model binder expects this url:

    http://localhost:54119/Designs/Multiple?ids=24041&ids=24117
    

    in order to successfully bind to:

    public ActionResult Multiple(int[] ids)
    {
        ...
    }
    

    And if you want this to work with comma separated values you could write a custom model binder:

    public class IntArrayModelBinder : DefaultModelBinder
    {
        public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
        {
            var value = bindingContext.ValueProvider.GetValue(bindingContext.ModelName);
            if (value == null || string.IsNullOrEmpty(value.AttemptedValue))
            {
                return null;
            }
    
            return value
                .AttemptedValue
                .Split(',')
                .Select(int.Parse)
                .ToArray();
        }
    }
    

    and then you could apply this model binder to a particular action argument:

    public ActionResult Multiple([ModelBinder(typeof(IntArrayModelBinder))] int[] ids)
    {
        ...
    }
    

    or apply it globally to all integer array parameters in your Application_Start in Global.asax:

    ModelBinders.Binders.Add(typeof(int[]), new IntArrayModelBinder());
    

    and now your controller action might look like this:

    public ActionResult Multiple(int[] ids)
    {
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have an ASP.NET MVC controller action that is called from a jQuery
I have a controller method in ASP.NET MVC that looks like this: public ActionResult
In ASP.NET MVC I have a controller that looks somehow like this: public class
I have an ASP.Net MVC Controller with a 'MapColumns' action along with a corresponding
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
ASP.Net MVC Controllers have several methods of forwarding control to another controller or action.
My question is as follows: I have a base controller (ASP.Net MVC controller) called
I have a controller in an ASP.NET MVC application. The page has several filters
I am using ASP.NET MVC 3. I have an action method called New. When
i have the following code in c#. I'm using ASP.NET MVC 3. public override

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.