Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用Asp.Net FileUpload控件时,在保存上载的文件之前,该文件在何处?_C#_Asp.net_File Upload_Webforms - Fatal编程技术网

C# 使用Asp.Net FileUpload控件时,在保存上载的文件之前,该文件在何处?

C# 使用Asp.Net FileUpload控件时,在保存上载的文件之前,该文件在何处?,c#,asp.net,file-upload,webforms,C#,Asp.net,File Upload,Webforms,在上载文件时,但在调用SaveAs()方法之前,我试图确定Asp.Net和/或IIS存储文件上载的位置 我看着它,我有点觉得它在内存中,而不是放在文件系统中,但我在任何地方都找不到它,它明确地说了这一点 我正在尝试向它验证上载的文件(其流在未调用SaveAs()的情况下被传递到FTP)不会被我们的服务器复制系统自动复制。以下内容来自 从内存转储中转储httprawuploaded内容,我可以看到该文件缓冲在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727

在上载文件时,但在调用
SaveAs()
方法之前,我试图确定Asp.Net和/或IIS存储文件上载的位置

我看着它,我有点觉得它在内存中,而不是放在文件系统中,但我在任何地方都找不到它,它明确地说了这一点

我正在尝试向它验证上载的文件(其流在未调用
SaveAs()
的情况下被传递到FTP)不会被我们的服务器复制系统自动复制。

以下内容来自

从内存转储中转储httprawuploaded内容,我可以看到该文件缓冲在C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\fileupload20\d909613c\d78e07ba\uploads Files文件夹中,名为f-zqaz-r.post
0:008> !do 017c3fbc
名称:System.Web.HttpRawUploadedContent+TempFile
方法表:68a870e0
EEClass:68a87070
大小:20(0x14)字节
GC生成:0
(C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0\u_b03f5f7f11d50a3a\System.Web.dll)
领域:
MT字段偏移类型VT属性值名称
7a754a14 4000fb0 4…empFileCollection 0实例017c4944\u临时文件
790fa3e0 4000fb1 8系统。字符串0实例017c54e4\u文件名
790fe3c8 4000fb2 c System.IO.Stream 0实例017c55f8\u文件流
0:008> !不需要017c54e4
名称:System.String
方法表:790fa3e0
EEClass:790fa340
大小:262(0x106)字节
GC生成:0
(C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
字符串:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ASP.NET临时文件\fileupload20\d909613c\d78e07ba\uploads\f-zqaz-r.post
如果要更改默认位置,元素的tempDirectory属性允许您指定编译期间用于临时文件存储的目录。默认值为空字符串(“”)。如果是空字符串,并且当前进程具有所需的访问权限,则文件将存储在%FrameworkInstallLocation%\Temporary ASP.NET files目录中。

显示
编译
元素,
tempDirectory
属性在上载过程中保存临时文件的位置。

FTW.+1。很好的发现。我想它必须在某个地方才能不消耗所有的web服务器内存,但我找不到引用。
Dumping out the HttpRawUploadedContent from a memory dump, I can see that the file is buffered in the C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\fileupload20\d909613c\d78e07ba\uploads files folder and is called f-zqaz-r.post 


0:008> !do 017c3fbc 
Name: System.Web.HttpRawUploadedContent+TempFile
MethodTable: 68a870e0
EEClass: 68a87070
Size: 20(0x14) bytes
GC Generation: 0
 (C:\WINDOWS\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll)
Fields:
      MT    Field   Offset                 Type VT     Attr    Value Name
7a754a14  4000fb0        4 ...empFileCollection  0 instance 017c4944 _tempFiles
790fa3e0  4000fb1        8        System.String  0 instance 017c54e4 _filename
790fe3c8  4000fb2        c     System.IO.Stream  0 instance 017c55f8 _filestream


0:008> !do 017c54e4 
Name: System.String
MethodTable: 790fa3e0
EEClass: 790fa340
Size: 262(0x106) bytes
GC Generation: 0
 (C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll)
String: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\fileupload20\d909613c\d78e07ba\uploads\f-zqaz-r.post


If you want to change the default location, The tempDirectory attribute of the <compilation> element allows you to specify the directory to use for temporary file storage during compilation. The default is an empty string (""). In the case of an empty string, and if the current process has the required access permissions, the files are stored in the %FrameworkInstallLocation%\ Temporary ASP.NET Files directory.