在C#中使用FileStream打开文件 [英] opening a file using FileStream in C#

查看:260
本文介绍了在C#中使用FileStream打开文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我正在使用pdf文件,在此我向控制器中的函数提交表单,以便在其中使用请求对象获取函数中的内容类型和内容长度.

以同样的热情,我通过使用Request.UrlReferrer.PathAndQuery将该文件的URL保存到字符串变量中,因此当我运行该应用程序时,它会给出不同类型的错误,例如
->找不到该文件的prt
->无法访问
->它已经打开

目标文件作为系统临时文件存储在temp文件夹中

谁能告诉我解决方案吗?

解决方案

编写代码以关闭文件,使文件不被锁定.


hi i am using pdf file where i am submitting the form to the function in the controller so where i am getting contenttype and content length in the function using request object.

in the same passion i am getting the url of the file where it is saved by using Request.UrlReferrer.PathAndQuery into string variable so when i run the application it is giving differenttype of errors like
-->could not find a prt of the file
-->can not be accessible
-->it is opened already

the target file is storing as system temporary file in temp folder

can any one tell me the solution

解决方案

Write code that closes your files so they are not locked.


这篇关于在C#中使用FileStream打开文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆