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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:31:02+00:00 2026-05-13T10:31:02+00:00

i wish to have a simple Action in my controller that accepts a few

  • 0

i wish to have a simple Action in my controller that accepts a few optional values and some integer values.

this is my route i wish to have:

HTTP.POST
/review/create

and this is the Action method i would like…

[AcceptVerbs(HttpVerbs.Post)]
public JsonResult Create(int userId,
                         int addressId,
                         byte baseScore,
                         byte reviewType,
                         string subject,
                         string description)
{ ... }

I’m under the uneducated impression that all of those arguments above will be populated by the forms collection values … but it’s not happening. Also, I have no idea how I would write a route, to handle those … because those values are form post data….

here’s my global.asax….

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    // Api - Search methods.
    routes.MapRoute(
        "Search Methods",
        "{controller}/{action}"
    );

In fact, the action method is never called because it doesn’t seem to find it 🙁

But, if create and action without any of those arguments, then it finds it ?????????

How would you write a route and action method to accept some require and some optional arguments, for the route /review/create ?

  • 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-13T10:31:03+00:00Added an answer on May 13, 2026 at 10:31 am

    As far as i can see you may rewrite your controller action like this:

    public ActionResult Create(int foo, int bar, byte blah, string name, int? xxx) {
        // code here
    }
    

    The ModelBinder will then ensure that foo,bar and blah are set. Name and xxx may be null. I can’t test it a the moment, but i think return type of the action should be ActionResult.

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

Sidebar

Related Questions

I have a simple class that contains some general information about the current web
I have a simple question and wish to hear others' experiences regarding which is
Here is the domain that I wish to have: public class Person { public
I have a 3d object that I wish to be able to rotate around
I have a class that I wish to expose as a remote service using
I have a shared library that I wish to link an executable against using
I have a simple ASP.NET MVC web application that uses NHibernate with FluentNHibernate's auto
I wrote very simple code to send emails. I wish that end users who
I wish to have long and short forms of command line options invoked using
If I have a non-template (i.e. normal) class and wish to have a template

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.