什么是asp.mvc请求之间存储数据的正确方法 [英] what is correct way of storing data between requests in asp.mvc
问题描述
我的应用程序从USB扫描器读取栏codeS。我把它们作为记号,然后建立从这些记号的命令。也许还有一种情况,我需要2个或更多读取之前,我可以创建一个命令。我需要存储previous以某种方式读取。其实什么是保持请求之间的一些数据的正确方法是什么?我没有用在我认为的标记。
My application reads barcodes from USB scanner. I treat them as tokens and then build commands from those tokens. There maybe a situation that I need 2 or more reads before I can create a command. I need to store previous reads in some way. Actually what is the correct way to keep some data between request? I do not to use that tokens in my view.
命令只有结果可被显示在视图中。
Only results of commands may be displayed in the view.
推荐答案
的的TempData code>词典是理想的存储控制器的动作之间的数据。它最常见于邮政/重定向/获取模式使用,但可以在这里申请。
The TempData
dictionary is ideal for storing data between controller actions. It's most commonly used in the Post/Redirect/Get pattern but could apply here.
这是一篇好文章来阅读它:<一href=\"http://www.devcurry.com/2012/05/what-is-aspnet-mvc-tempdata.html\">http://www.devcurry.com/2012/05/what-is-aspnet-mvc-tempdata.html
This is a good article to read about it: http://www.devcurry.com/2012/05/what-is-aspnet-mvc-tempdata.html
这篇关于什么是asp.mvc请求之间存储数据的正确方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!