I have a very simple page with which a user uploads a file. Using only server-side C# (e.g. the code-behind), how can I measure the amount of time the user had to wait for the file to upload?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is very difficult (well, it was in IIS6). You need to write an HttpModule to intercept the upload and handle it, then using the total size of the file coming in (it’s in the header of the request), calculate how many bytes per second you’re getting, and then you can calculate how much time is left.
However, you cannot do any of this with just the code-behind file — the file is already uploaded and available by the time the request gets to the asp.net handler.