开发者

Keeping alive PostedFile.InputStream (ASP.NET)

开发者 https://www.devze.com 2022-12-17 12:17 出处:网络
Maybe it\'s the worst practice in the world, but I was wondering wich\'s the best way to \"keep alive\" the InputStream of the FileUpload Control.

Maybe it's the worst practice in the world, but I was wondering wich's the best way to "keep alive" the InputStream of the FileUpload Control.

I would give you one example. Let's assume you have the FileUpload control in one WebForm, and you want process it in the next WebForm (after Response.Redirect).

It would be great (unless for the memory) to have something similar to:

Session["PostedFile"] = this.FileUpload.PostedFile.InputStream.
开发者_StackOverflow中文版

Unfortunately, this results in:

System.ObjectDisposedException

Thanks in advance.


Why don't you read the stream first and then add it to the session?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号