Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WebClient DownloadFile
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
WebClient DownloadFile
Versions des environnements
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01622554
Message ID:
01622554
Vues:
27
Hi all,
I'm linking to a URI to retrieve a file. The person I got the code from says it works fine for him and he sent me the results, but when I run it I don't get a complete file but one about 1/6th the size of his. Exact same code, any ideas?
muri = @"https://secure.website....&AuditID=" + @mauditid;
 filePath = mfolderpath + fileName + "_WebPDF_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + mloop.ToString() + ".PDF";

WebClient c = new WebClient();
var credCache = new CredentialCache();
credCache.Add(new Uri(muri), "NTLM",
      new NetworkCredential("username", "password"));
var request = (HttpWebRequest)WebRequest.Create(muri);
c.UseDefaultCredentials = true;
c.Credentials = credCache;
c.DownloadFile(new Uri(muri), filePath);
~M
Go raibh maith agat

~M
Répondre
Fil
Voir

Click here to load this message in the networking platform