ASP.NET MVC Action Method Parameters from Querystring do not change after the first request

I have an action method in the controller that needs to perform paging. I pass the page number and pageize parameter to querystring. The problem is that the first request I create sets the parameters for all subsequent calls.

public ActionResult GetStuff(string key, int? page, int? pageSize)
{
  // do something magical
}

My route is as follows:

routes.MapRoute("GetStuff", "Stuff/{key}", new {controller = "Stuff", action = "GetStuff"});

When I start debugging my application, I go to url / Stuff / My_Stuff, and the key parameter is correct, and both pages and pages are set to zero as I expected. Should I make a second call with url / Stuff / My_Stuff? Page = 2 & pageSize = 3, then the page and pageSize values ​​are still zero. If I restart the application and make my first call, turn on the page and page settings, everything will work as I would expect, but then changing these values ​​in subsequent calls saves the values ​​from the first call. In fact, even the key parameter that is part of my route will support the same value, even if I change my Url. What am I missing?

IIS 6.1 Windows Server 2003. . , VB.Net, , . , .

+3
1

, DI (Castle Windsor) . - lifetime Controller, Castle - Singleton ( , ).

, Controller , .

Transient .

+3

Source: https://habr.com/ru/post/1719644/


All Articles