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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:54:36+00:00 2026-05-10T19:54:36+00:00

I have something similar to the following method: public ActionResult Details(int id) { var

  • 0

I have something similar to the following method:

    public ActionResult Details(int id)     {         var viewData = new DetailsViewData         {             Booth = BoothRepository.Find(id),             Category = ItemType.HotBuy         };         return View(viewData);     } 

and the following Route:

routes.MapRoute('shows','shows/{controller}/{action}/{id}', new {id = 0}); 

Everything worked fine before the Beta, when I had Preview 3. Now the method will fill the id correctly the first time I execute the action. However the second time the controller’s ModelState contains the last-use id value. This causes the ActionInvoker to use it in the method’s parameter instead of the Route value.

So if I call the action twice on two different entities the results are such:

www.mysite.com/shows/Booth/Details/1  => Details(1) www.mysite.com/shows/Booth/Details/2  => Details(1)  //from ModelState['id'] 

From my quick scan with Reflector it seems it first binds parameters to the ModelState then to Routes. However, I never even posted anything from the model. As far as I can tell the ModelState should not contain anything.

Is this a bug in the Beta, possibly a bug somewhere in my code, or is there some design feature that I am ignorant of? Any insight into the nature of ModelState and why this happens is appreciated.

EDIT: I discovered that this issue is actually a symptom of what appears to be a bug with the DefaultValueProvider if you instantiate a Controller from an IoC container that exists for the lifetime of the Asp.Net application.What happens is that the DefaultValueProvider uses the first ControllerContext given to the Controller and never updates it until the controller is recreated. This causes old RouteData to be used for method parameters instead of the current RouteData.

  • 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-10T19:54:36+00:00Added an answer on May 10, 2026 at 7:54 pm

    It’s hard for me to tell what you expect to happen and what is happening from your post. Is it possible there’s an error in your BoothRepository.Find method such that it returns the same thing every time?

    ModelBinder should not be affecting this method because the parameter to the action method is a simple type, int.

    Were both of these requests GET requests? If you still are having problems, can you try and create the simplest repro possible and email it to philha – microsoft dot com?

    EDIT: The problem ended up being that the developer was attempting to re-use the valueprovider across requests (by having Castle Windsor manage the lifecycle of Controllers). Right now, there’s no support for re-using controller instances across requests like you would with IHttpHandler which has a IsReusable property. So in general, reusing controllers across requests requires doing a lot more work on your end. 🙂

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

Sidebar

Ask A Question

Stats

  • Questions 70k
  • Answers 70k
  • 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 See this answer: Script all stored procedures in Management Studio… May 11, 2026 at 12:49 pm
  • added an answer Find the first row where there does not exist a… May 11, 2026 at 12:49 pm
  • added an answer private void CompressAndSaveImage(Image img, string fileName, long quality) { EncoderParameters… May 11, 2026 at 12:49 pm

Related Questions

I have already posted something similar here but I would like to ask the
I have used getopt in Python and was hoping there would be something similar
I have something like this: barProgress.BeginAnimation(RangeBase.ValueProperty, new DoubleAnimation( barProgress.Value, dNextProgressValue, new Duration(TimeSpan.FromSeconds(dDuration))); Now, how
I have something here that is really catching me off guard. I have an
Is there a library that will recursively dump/print an objects properties? I'm looking for
I've got a method which currently takes an IList as a parameter, where UserBO
I was of the opinion that virtualization doesnt work in the super class constructor
I'm wondering what good ways there would be make assertions about synchronization or something

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.