WebClient UploadFile errors

为君一笑 提交于 2019-11-29 12:10:06

The exception "The request was aborted: The request was canceled." is thrown if the WebClient times out during a file transfer. If no file transfer is taking place, you will get "The operation has timed out" instead.

The timeout is occurring on the client. WebClient does not allow you to set the timeout and the default for HttpWebRequest (what WebClient uses) is 100 seconds. I guess I will have to figure out how to get the progress when using HttpWebRequest. I will also have to figure out why ASP.Net file transfer is slower than using SAFileUp with classic ASP.

UPDATE: I've created a WebHelper class that takes the place of WebClient but provides more access to the necessary features of the underlying WebRequest. It also provides a bunch of additional capabilities over the WebClient. If you are interested, it is available in the BizArk project on CodePlex.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!