Route paramter is always the same after first request

Last post 10-30-2008 8:26 AM by Ruprict. 2 replies.

Sort Posts:

  • Route paramter is always the same after first request

    10-29-2008, 5:05 PM
    • Member
      8 point Member
    • Ruprict
    • Member since 11-28-2005, 10:46 AM
    • Charlotte, NC
    • Posts 6

    So, I am defining a route like so:

     
     routes.MapRoute(

    "Templates",

    "template/{templateName}",

    new {controller="Template", action="GetTemplate" }

    );
     

     Which works great for the first request, but the 'templateName' parameter holds on the the value of the first request through.  So, if my initial request was http://myserver/template/template1, then templateName=template1, forever.  I can send http://myserver/template/template2, and (stepping through the action) templateName is still template1 until I restart the app.

     My guess is I am doing something silly, but can't see what it is.

     Thanks,
    Ruprict

     

    Filed under: , ,
  • Re: Route paramter is always the same after first request

    10-29-2008, 6:37 PM
    Answer
    • Contributor
      4,475 point Contributor
    • levib
    • Member since 07-23-2007, 11:50 PM
    • Redmond, WA
    • Posts 780
    • AspNetTeam

    Are you perhaps using an IoC container to retrieve your controllers?  If so, it may be that your controller is incorrectly servicing more than one request.  See http://stackoverflow.com/questions/238460/aspnet-mvc-beta-1-defaultmodelbinder-wrongly-persists-parameter-and-validation#241258 for more information.

    If you're not using an IoC container, please let us know so we can look into this further.  Thanks!

  • Re: Route paramter is always the same after first request

    10-30-2008, 8:26 AM
    • Member
      8 point Member
    • Ruprict
    • Member since 11-28-2005, 10:46 AM
    • Charlotte, NC
    • Posts 6

    That was it.  I can't believe I missed that.  Thanks!

     

    "Why do things that happen to stupid people always happen to me?" - Homer Simpson

Page 1 of 1 (3 items)
Microsoft Communities