Linked Questions

Popular Questions

c# The given path's format is not supported. UNC Path

Asked by At

I am trying to access and download a bak file from a remote server and keep getting the error "The given path's format is not supported." The code I am using below:

string uncPath = Server.MapPath(Path.Combine(@"\\TSTSVR\Users\temp_databaseBackups_000kfkf000", 
  string.Format("{0}-{1}.bak", ddlDatabases.SelectedValue, DateTime.Now.ToString("yyyy-MM-dd"))));

WebClient webClient = new WebClient();
webClient.DownloadFile(uncPath, ddlDatabases.SelectedValue + "-" + DateTime.Now.ToString("MM-dd-yyyy:hh:mm"));

I am getting the error at the DownloadFile line. Am I declaring the UNC path wrong? The folder is there on the server and I set access to Everyone with write permissions.

Related Questions