I have an application that will upload files from my client to a web server using HttpWebRequest (with the function suggested here: Upload files with HTTPWebrequest (multipart/form-data))
My problem is that when the file (about 10 mb in size) is being posted the whole application freezes (e.g. “application is not responding” when I try to move the window).
Do I need to put the uploading in a separate thread, or is there any other simple way solve this?
Have a look at the
BackgroundWorkerclass. Your UI will freeze while an operation is ongoing unless you run it in a separate thread.Using the
BackgroundWorkeryou can execute your code in theDoWorkevent and the UI will remain responsive.