Reputation: 2815
I have my own domain. I want to use it as a storage for my desktop application. I have made an application that creates a text file. Now I want to store it on my domain so that I can access it globally and by access globally I mean that I create another form that searches and displays all the text files. Even if I run my project in another pc i should not have to change anything and it keeps on working.
Upvotes: 0
Views: 142
Reputation:
Do you have any FTP?For uploading a file we have many way that one of them is using FTP. For example this code is from MSDN that using FTP:
FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://www.contoso.com/test.htm");
request.Method = WebRequestMethods.Ftp.UploadFile;
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential ("anonymous","[email protected]");
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader("testfile.txt");
byte [] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
response.Close();
}
Upvotes: 2