我試圖確定在您調用SaveAs()
方法之前上傳文件但是時Asp.Net和/或IIS存儲文件上載的位置。使用Asp.Net FileUpload控件保存之前上傳的文件在哪裏?
我看着MSDN,我有點想到它在內存中,而不是放在文件系統上,但我無法在任何地方找到它,它明確表示這一點。
我試圖向IT驗證上傳的文件(其流傳輸到FTP而沒有調用SaveAs()
)將不會被我們的服務器複製系統自動複製。
我試圖確定在您調用SaveAs()
方法之前上傳文件但是時Asp.Net和/或IIS存儲文件上載的位置。使用Asp.Net FileUpload控件保存之前上傳的文件在哪裏?
我看着MSDN,我有點想到它在內存中,而不是放在文件系統上,但我無法在任何地方找到它,它明確表示這一點。
我試圖向IT驗證上傳的文件(其流傳輸到FTP而沒有調用SaveAs()
)將不會被我們的服務器複製系統自動複製。
以下是從How to change the default TempFile upload location for the ASP.NET 2.0 FileUpload control?
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.
compilation Element (ASP.NET Settings Schema)示出了其中tempDirectory
屬性保持位置的臨時文件而上傳過程中的compilation
元件。
[進程監視器](http://live.sysinternals.com/procmon.exe)FTW。 – 2012-02-03 22:32:43