I am trying to save XML file on a server and send it to another remote over FTP. To create/save XML file, I am using
XmlWriter writer = XmlWriter.Create("d:\\path\\to\\folder\\filename.xml");
and upload to FTP.
FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(filename);
Everything works fine. It creates XML file, save to folder, send to FTP correctly. But now I am in a trouble while deploying the code. We have a load balancer and two prod servers. so I cannot be sure where will it save at the moment. and since it may not be available at the other server, I might get 404.
Is there a way I can specify servername before file location when I save XML file? Basically I want a common location specifier to look into like hostname/ipaddress along with implemented code already.