using System.Net; // WebRequest
private bool DownLoad(string wFileName,string LocalFileName)
{
string FileName = Path.GetFileName(wFileName);
if (PublicFunction.IsRunTime())
{
string URL = "http://" + LRClient.APServer + "/LRERP/Export/" + FileName;
try
{
WebRequest RST = WebRequest.Create(URL);
WebClient wc = new WebClient();
wc.Credentials = CredentialCache.DefaultCredentials;
wc.DownloadFile(URL, LocalFileName);
return true;
}
catch(Exception ex)
{
PublicForms.RunfrmMsg("Error",ex.Message);
return false;
}
}
else
{
File.Copy(wFileName,LocalFileName,true);
return true;
}
}
沒有留言:
張貼留言