c# - Sharing variables between actions in asp.net MVC -
c# - Sharing variables between actions in asp.net MVC -
i have next scenario may warrant storing info in conroller fellow member variable in order share between actions.
i have search form , button - when clicked, table total of info returns according search form parameters. 1 action - , clean.
i asked set excel button user can download table in excel format. don't want run db query again, since info there, since using server side excel component, need info available on server in order shove excel.
my initial thought have variable in controller info can stored. have never seen beingness done in asp.net mvc. accepted pattern? understanding each action sort of isolated.
the mvc pattern encourages statelessness. means if want maintain info between actions needs posted client (the server shouldn't maintain state relating specific session). (so yes each action should isolated, , shouldn't reliant on previous action, ie shouldn't rely on setup previous request)
take read of scott gu's blog on mvc means here http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx
if having performance problems accessing info recommendation utilize serverside caching of info fetch. should ideally implemented in info access or query layer in application , shouldnt tied specific session
c# asp.net-mvc software-design
Comments
Post a Comment