Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WebClient DownloadFile
Message
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
WebClient DownloadFile
Environment versions
Environment:
C# 4.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01622554
Message ID:
01622554
Views:
26
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
Reply
Map
View

Click here to load this message in the networking platform