Getting file size in Silverlight 4 -
i'm downloading (from server client) file using webclient object:
webclient wc = new webclient(); wc.openreadcompleted += load_transfercompleted; wc.openreadasync(uriaddress, filename);
i know file size before starting download operation. there way in sl4?
thanks help.
gilad.
here air code play (i haven't tested myself)
webrequest req = webrequestcreator.clienthttp.create(youruri); req.method = "head"; req.begingetresponse(ar => { webresponse resp = req.endgetresponse(ar); int length = resp.contentlength; // stuff length }, null);
by using clienthttp
stack can use "head" request return same set of headers "get" not actual entity body.
there @ least 1 thing out though, none of existing cookies uri sent in request. if response sensitive cookies (for example because needs session id) things whole lot more complicated.
Comments
Post a Comment