ASP.net 会话变量中存储的最大数据量
我有一个表单,用户可以在其中上传 Pdf 文件(一个文档大约 30 页左右)。我想延迟将这些 Pdfs 存储在数据库中,直到用户提交整个表单。问题是上传的文件集合必须能够通过回发持久保存。话虽这么说,我正在考虑将它们存储为会话变量,但是,这是否需要存储太多数据,或者会话变量是否意味着到处存储几个字符串?如果这种方法不可接受,是否有替代方法?
I have a form where users can upload Pdf files(about 30 pages to one document or so). I want to delay storing these Pdfs in the database until the user submits the entire form. The problem is that the collection of files uploaded must be able to persist through postbacks. That being said, I am considering storing these as session variables, however, would this be too much data to store, or are session variables meant to store a couple strings here and there? If this method is not acceptable, is there an alternate method?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是灾难的请求。
将它们作为临时存储在磁盘或 SQL 上,并且仅存储它们的路径或 id。正如您自己所说,“会话变量意味着在这里和那里存储几个字符串”,
我认为甚至路径或 id 也必须存储在数据库中,这样如果您的服务器回收会话,您就不会丢失所有数据,并且用户可以保留它一段时间,直到超时并清除文件。
It is a request for disaster.
Store them on disk or SQL as temp, and only store the path or id to them. As you said it yourself "session variables meant to store a couple strings here and there"
I think even path or id must be stored in database as well so that if your server recycles the session, you do not lose all that data and user could have it for a period of time until a timeout which you clear the files.
您可以在会话变量中存储的数据量仅受服务器上内存量的限制(如果您使用的是使用内存的会话持久性系统)。您需要计算要在一台计算机上服务多少个并发用户,计算出每个会话将使用多少内存,并确定是否有足够的内存。
The amount of data you can store in session variables is limited only by amount of memory on your server(s) (if you're using a session persistence system that uses memory). You need to calculate how many concurrent users you want to serve on a machine, figure out how much memory you'll use per session, and figure out whether or not you've got enough.