I need to upload files from my asp.net (C#) page residing in the web server to a remote server.
I managed to upload files to remote server from localhost using this
In FileUpload1.PostedFile.SaveAs(path), path is physical path of file, No Url. You must check:
if answer of both question is true check this code:
string serverPath = @"\\xxx.xxx.xxx.xxx\Folder\";
if (!System.IO.Directory.Exists(serverPath))
System.IO.Directory.CreateDirectory(serverPath);
FileUpload1.PostedFile.SaveAs(serverPath + FileUpload1.FileName);
The account your application runs under must have write permissions to the folder you are trying to upload the file to: \\xx.xxx.xx.xx\Folder\
. So you will have to configure the application pool in IIS to run under an account that will have sufficient permissions. Go to the application pool properties in the IIS management console where you will be able to specify an account to be used to run the application. By default it uses a built-in account which won't have any access to shared resources. Take a look at the following article which explains how to do so.
You need a virtual directory on your webserver to upload to. In code you'll have to use Server.Mappath("virtual path") function to get its server path and then save to it.