Hi,
I'm trying to create and store Json file to the server each time with different name(using windows services), without saving on my application it should directly store to FTP location.
I have tried as following
- string ftpAddress = "http://dev-web/hrm/assets/";
- string username = "developer";
- string password = "123";
-
- WebRequest request = WebRequest.Create(ftpAddress);
- request.Method = WebRequestMethods.Ftp.UploadFile;
- request.Credentials = new NetworkCredential(username, password);
-
- string currentDirectory = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
-
- using (var sw = new StreamWriter(request.GetRequestStream()))
- {
- sw.Write(jsondata);
- sw.Flush();
- sw.Close();
- }
This code doesn't work and neither giving me any error. I just want to know how to give particular name to the files.