"" flash silverlight. , , , - maxRequestLength web.config.
:
<system.web>
<httpRuntime maxRequestLength="1024"/>
1 . - , , , . , , IIS, .
:
, , , , URL-, 2 . .NET WebClient:
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new System.ComponentModel.AsyncCompletedEventHandler(DownloadCompleted);
webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(DownloadProgressChanged);
webClient.DownloadFileAsync(new Uri("http://www.somewhere.com/test.txt"), @"c:\test.txt");
private void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
WebClient webClient = (WebClient)(sender);
if (e.TotalBytesToReceive > iMaxNumberOfBytesToAllow)
{
webClient.CancelAsync();
}
}
private void DownloadCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
{
}
, - , :
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri("http://www.somewhere.com/test.txt"));
webRequest.Credentials = CredentialCache.DefaultCredentials;
HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();
Int64 fileSize = webResponse.ContentLength;
if (fileSize < iMaxNumberOfBytesToAllow)
{
}
, , , .