Search code examples
asp.netvb.nethttppostedfilebase

Upload file takes long in the first time, ASP.NET


I recently having a problem in my web application, which is the upload process of my documents.It takes a long time for even a few kb doc/xls to upload.

The way i upload the document is:

<input type='file' id='document_file@(letter_process.id)' 
name='document_file@(letter_process.id)' value='Choose File'>

Just ignore the razor syntax, i am using input type file to upload doc from a local PC through HttpPost.

AND

This is my httpruntime in web.config:

<httpRuntime targetFramework="4.5" 
             requestValidationMode="2.0"
             maxRequestLength="4096"
             requestLengthDiskThreshold="256"
             />

However,no matter how i tuned the maxRequestLength or requestLengthDiskThreshold, seems not much of a big difference.

After all processing,i will assign it to a variable called file to make use of it.

Dim file = Request.Files("document_file" & generate_step)

or just other controller making use of other uploads in the same way.

Dim documentFile As HttpPostedFileBase = Request.Files("document_file17")

That's all of my steps and it functions normally, except it takes quite a long time to upload the file.


Solution

  • After testing, and deployed to different machines, it is bandwidth limitation.