0
我需要傳送文件到客戶端無需緩衝到內存 所以我用Response.TransmitFile但這個函數拋出PathTooLongException 我可以在IO.File函數處理這個異常,但我沒有發現任何soluton這個的TransmitFile堆棧跟蹤就像吹使用Response.TransmitFile扔PathTooLongException
Message :The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
StackTrace : at System.IO.PathHelper.GetFullPathName()
at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Web.HttpResponse.TransmitFile(String filename, Int64 offset, Int64 length)
at _Default.Page_Load(Object sender, EventArgs e) in Download.aspx.cs:line 151
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
我的朋友我知道這是爲什麼錯誤時拋出拋出,問題是如何處理路徑的長度超過260個字符長,這是不是.NET的Windows API和我的極限沒有權限重命名文件或文件夾,所以它需要b處理 – Hamid
據我所知,這是undernet API使用限制。 – Peter
沒有在.net中的其他功能這種限制的解決方法只是谷歌它,但我沒有找到任何此功能 – Hamid