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

  • Home
  • SEARCH
  • 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 110209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:11:27+00:00 2026-05-11T02:11:27+00:00

I see that there is Controller.RedirectToAction(string actionName, string controllerName, object values) but I never

  • 0

I see that there is Controller.RedirectToAction(string actionName, string controllerName, object values) but I never got the values parameter to work. Consider I want to do the following overload of actions in a controller:

public ActionResult Read()  {     return RedirectToAction('ReadPage', 'MyController', 1); }  public ActionResult ReadPage(int page) {     // Doing the actual stuff  } 

…I get exception when I try to go to the Read action. The same goes with Html.ActionLink.

What’s up with that? Can you pass values to controllers without going to the browser at all in MVC?

  • 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. 2026-05-11T02:11:28+00:00Added an answer on May 11, 2026 at 2:11 am

    Try using:

    return RedirectToAction('ReadPage', 'MyController', new {page = 1}); 

    It needs to know which argument you mean (as in the more general case, you can have lots of parameters), which it can infer from the above.

    The anonymous type pattern (above) is very cmomon in ASP.NET MVC, although in many cases I believe you can also give it a populated dictionary to mean the same.

    Also – there is no need for two actions in this case; you can set up your routes to supply default values; here’s some I posted earlier:

        public ActionResult Search(string query, int startIndex, int pageSize)     {         ...     } 

    with routes:

        routes.MapRoute('Search', 'Search/{query}/{startIndex}',              new {                 controller = 'Home', action = 'Search',                 startIndex = 0, pageSize = 20              }); 

    Now if I don’t supply a startIndex, it passes 0 to my Search by default. So I can navigate to ‘/Foo’ for a default search, or ‘/Foo/100’ to do the same search starting at 100. Alternatively, the args can be on the query string, and will still get defaulted using the values from the anon-type.

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

Sidebar

Ask A Question

Stats

  • Questions 73k
  • Answers 73k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I have seen obj and val used. I do not… May 11, 2026 at 2:07 pm
  • added an answer For a separate project, I took the country code data… May 11, 2026 at 2:07 pm
  • added an answer Are the excluded files under source control along with the… May 11, 2026 at 2:07 pm

Related Questions

I see in richfaces that there is a single slider, wondering if anyone has
I know there is a tool that enables me to see what actually gets
I see that within MySQL there are Cast() and Convert() functions to create integers
There are a couple of different .NET XSLT functions that I see used in
I really like the way ASP.NET MVC works. I'd love to implement it on
In ASP.NET MVC is there an equivalent of the Html.ActionLink helper for Img tags?
I'm having a problem getting a controller method that returns a JsonResult to accept
Is there an FTP browser hiding away in NetBeans 6.1? The help manual doesn't

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.