Asp.net fileupload transfer rate - c#

Is there any way to easly know Transferrate between server/client during un filupload upload? Because uploading a file of 4,13Mb take about 5 or 6 minutes.... Is there anyway we can track it, by writing it in flatfile, email, response.write anything!! We're stuck.
Thanks to help us :(!

Not if you're using the built-in asp:FileUpload control. Some third party AJAX-based upload controls probably do this, but I don't know of any offhand.

Not easily.
HTTP works this way: you send ALL data and, after that, server begins to process your request.
But you can write some client code (flash, applet, silverlight) which break a file in pieces and send them, one at time, to server. This way you can compute your transfer rate.

Use a flash upload tool like SWFUpload, by which you can detect the upload speed, and then send the total time/speed to the server once the file is done.

Related

Best way to convert a video while uploading - ASP.NET C#

It´s simple. I have a page where the user can upload a video that will be stored in a directory inside the application.
But, as we know, the user can upload a 2mb video or 700mb video. What I need to do is convert the video while uploading or after upload (I don´t know which is the best way), in order to avoid large videos stored on the server.
I´m not sure but I think Youtube do the same thing.
OBS: I pretend to use the HTML5 video player.
Thanks very much for your reply! =)
As with all video questions, the answer is: It depends.
Some containers are designed for streaming (flv, mpeg-ts) and others are designed for random access (mp4, mkv). Some random access containers can be used for pseudo-streaming where the client can perform byte-range to performing random access over http.
If you have a user upload an flv, you can convert it as it streams up to you. If you have a user upload an mp4 with the moov atom at the end, you need to cache the entire file before you can do a conversion. if the moov atom is at the beginning, you can convert as it streams.

csv file upload on asp.net

User need to upload 30,000 csv values, these values may contain 16 digit numbers or zipcodes.
Now our asp.net project doesn't use AJAX tool kit controls or jquery or any other 3rd party controls or open source code. This is restriction as per companies privacy policy.
So I have to come with a best way to accommodate file upload feature. This has to be versatile in regards to re-usability some thing like a custom control
This file upload feature should not be saved on the server, instead I need to read data into stream buffer and send them to UI then once user verify these values he/she'll have to hit submit thus values will be saved to DB.
what are the best ways to implement this,
Can I make use of System.Net.Webclient? or
Is there any other alternative ways by using Async HttpHandlers?
Can I show file upload progress to UI ?
Appreciate if you could help me with proper guidence on this.
Thanks in advance
krish
Well 30,000 values of zipcode or any other 16 digit code should be uploadable normally using file control(i mean via postback).
if you have to read and show 30,000 on the UI, i presume you are at risk of freezing your UI.
Moreover if you are not on HTML5, there is no way that you can read the content on the client side, except if you fiddle around with flash.
HTML 5 file api reference
http://www.html5rocks.com/en/tutorials/file/filesystem/
How to read and write files with Flash(Action script)
http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/

Play mp3/wav file from memorystream to webpage

Recently I was approached to develop an application (asp.net/c#) to allow users to listen some audio files stored in some shared folders.
The users didn't have access to the shared folders, and the files should be streamed. Also, the page should provide the play/stop/pause/forward/back functions, as well as time elapsed/total time information.
So I setup a webservice that access the required file, and return a Byte[] containing the mp3/wav audio (actually I have to convert them to the desired mp3/wav format prior to returning the Byte[]).
The problem is that I have no idea on how to present it in the webpage.
What i need is a webpage with some control that provides the necessary functionalities and information, loaded from a Byte[].
I've researched the web and tried a lot of snippets and controls with no luck at all.
Any ideas or directions on how to implement it?
Thanks in Advance,
António
You could use HTML5's audio tag, if you expect your users to be using fairly recent browser versions. You'd set the src to a URL that would be set up to write your byte[] to the response stream (e.g. maybe store the byte[] in Session, make an .ashx handler page to return that, and set src="myHandler.ashx").
A good approach would be to use silverlight or flash player, even a java applet.

Sending PDF with Fast Web View in ASP.NET

I am using ASP.NET 4.0 + IIS 7 to serve up a number of large PDFs via Response.TransmitFile.
The PDFs are all linearized, i.e. "Fast Web View". However the browser still requires the entire PDF to be downloaded before displaying any of it. All I want to do is show the first page (at least) without having to wait several minutes for the entire PDF to download.
From what I have read, the response header should include ["Accept-Ranges", "bytes"] but this does not seem to help.
Can anyone give me some pointers?
Thanks in advance!
I don't think you can do that easily. For byte range to work you would need many requests to serve the same file. How would you associate all these requests with a single file instance? You would probaly need to save the file to disk or somehonw maintain the file in memory... it could get tricky...
Much simpler would be to save PDFs in a shared folder (a first in first out cache) and let the HTTP 1.1 do the rest.

How to measure upload and download internet speed with silverlight and ASP.NET MVC

How to measure upload and download internet speed with silverlight and ASP.NET MVC between client and server.
How I think it's need to download/upload a file on the server.
Please help me with this problem
Thanks in advance
Sounds like you are trying to recreate SpeedTest.net. They use Flash, but the concepts should be roughly the same.
If you're referring to ASP.NET MVC because the Silverlight app is hosted on it, I'm not sure it will impact your design. This assumes that all the speed testing logic and UI is implemented in the Silverlight application.
Here's a good article from Laurent Bugnion on downloading files using WebClient:
http://www.galasoft.ch/mydotnet/articles/article-2008032301.html
That should give you all the information you need to download the file to the client, display a progress bar, and be notified when the download is complete. Using a fixed-size dummy data file, you can easily calculate the speed based on the size and time to download. The file should be fairly large but not too large, say 10 - 15Mb. That will ensure an accurate estimate of speed for both slow and very fast connections.
Uploading will work the same way in reverse. KrystalWare's SlickUpload component should have all the features you need.
The quick and dirty way to do it is just transfer a file to the client and have it send it back.
What you will need to do is have a file of known size, download it to the client, take the filesize/time to transfer and that is your download speed. Do the reverse process to get the upload speed.
It is a good idea to have a file at least a few MB in size so it can average out the peeks and valleys in the transfer.
You realize, of course, that the results of your test will be completely dependent on the internet connection that you are using to run the test. From what I am reading, your really just testing your internet connection, which you can do on various websites, such as www.speedtest.net.

Categories