I’m downloading (from server to client) a file using a WebClient object:
WebClient wc = new WebClient();
wc.OpenReadCompleted += Load_TransferCompleted;
wc.OpenReadAsync(uriAddress, Filename);
I would like to know the file size before starting the download operation. Is there a way to do this in SL4?
thanks for your help.
Gilad.
Here is some air code for you to play with (I haven’t tested it myself)
By using the
ClientHttpstack you can use “HEAD” request which will return the same set of headers as a “GET” but not the actual entity body.There is at least one thing to look out for though, none of the existing cookies for the uri will be sent in the request. If the response is sensitive to cookies (for example because it needs a session id) then things will get a whole lot more complicated.