Using session to store uploaded files
Is it safe and recommended to store larger uploaded files in asp.net session (httpsessionstate) ?. In this scenario session would be used as a temporary storage for multiple file uploads and later files would be transferred to disk/db and sessi开发者_JAVA技巧on cleared out.
It is probably not a good idea in general to store larger files in memory, and it is similar with the session. Keep in mind that there is some memory limit on the session (web server process etc.) always and with large files / many users you are very likely to exceed it.
Consider storing temporary files instead, when permissions are set correctly this could be an alternative solution, probably you can keep just the filename and path in the session and delete the file when the session item expires (just to avoid filling the disk with garbage).
精彩评论