Visual Studio 2008
I have a xml file I want to send to a ubuntu server.
Before I was using the following to save on the current machine in the application folder. However, the customer has changed and now wants to store it on a remote network ubuntu server.
dt.WriteXml(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Config.xml"));
What is the best way to send files across the network? Is it possible to send files from a windows machine to a ubuntu server machine?
Many thanks for any advice,
The easiest solution is probably to use a samba daemon and plain old file copying. If your customer wants to use the Ubuntu server as a file server, they may have already set this up.
Another option is to run an FTP daemon on the server and use the WebClient class to upload the file to it. You can use the WebClient.UploadFile method to upload a file to the server or WebClient.UploadString to upload the string directly, using the FTP STOR command.
The easiest thing to do is probably to SCP it onto the remote machine.
Run a samba daemon on the ubuntu server and you can use shared folders (SMB) to transfer the file.
Related
I want to upload files to server by giving file list in text file like
c:\file1.ext
c:\file2.ext
is this possible without using UploadFile control or form method in asp.net c# ?
Only if the server and client are on the same LAN or VPN, you can think of using this:
String source = #"c:\file1.ext";
String desctrination = #"\\SERVER\TRANSFERDATA\file1.ext";
File.Move(source, desctrination);
or
File.Copy(source, desctrination);
It's impossible to grab files from client's machine without using fileupload controls.
Http protocol doesn't allow to do that.
You could have file transfer on client's machine and it could send you those files, or you could have web service for uploading files, but you can't directly grab files from client's machine
If you want a quick and easy answer no, but there is no such thing as impossible!! you can do one of those options:
Creating WCF service and let client install it in his PC.
Using ActiveX.
in video link Below you can see that ASP.net application accessing point of sale device that plug to client PC, now if that application can access device, you can access the C drive..
Connect to POS device throw asp.net
Hi I have a C# Windows Service installed on a server.
On the other side, the service starts a timer that will read files from a network folder.
My customer requires that a fixed length file is created on a network folder, then they have a process that will do some stuff to the file and in case of success the file is deleted but in case of an error the same file but with extension .err is created.
I know that there are Windows API's that its possible to trigger an event every time a file is created, the thing is that this folder is not on the same server where the service is running.
Is that possible? Mapping the folder into the server will do the trick?
The FileSystemWatcher class in .NET will use the appropriate Windows change notification APIs, and the SMB 2.0 protocol supports change notifications that get delivered via the Windows change notification APIs.
So, if the remote server supports SMB 2.0 (Windows Server 2008 or above, Unix hosts running Samba 3), then the FileSystemWatcher class should do the trick.
I transfer (upload) the batch file to the server using FTP in C# (FtpWebRequest). Batch files have some commands. My requirement is to transfer the batch file to the server (which I am able to do) and execute that batch file.
How do I execute the commands in the batch file on the server from my client? Can I use Process.Start() approach or rsh?? Which is better way of doing it and a link to the example would be appreciated.
Last time I needed to copy and run a batch file remotely, I used PSExec. However, that needs administrator rights on the remote machine.
You can try to use SITE FTP command to run the file, but this is server- and OS-specific (i.e. you can't start a .BAT file on Unix or .sh file on Windows server, and also not all servers support execution of external command via SITE command).
If this doesn't help, you would have to setup some server (eg. SSH server) on the remote side, and after uploading via FTP connect to that SSH server using SSH protocol (but if you use SSH, you don't need FTP - you can use SSH-based SFTP instead).
You could run a scheduled task (say every five minutes) that runs your batch file. You might have to do some clean up tasks like remove the batch file after you have run it (so it doesn't inadvertently run again).
(If your batch file had a different name every time...might have to rethink this a bit.)
Nice thing about this is that it is very simple, it uses the very reliable Windows scheduler and no 3rd party applications are required.
Nayan Soni For Execute Bath File System.Diagnostics.Process.Start(FileName, Parameters);
And For Socket Ref : http://www.codeproject.com/Articles/10649/An-Introduction-to-Socket-Programming-in-NET-using
this sample http://diaryanakku.files.wordpress.com/2013/01/socket.jpeg (change file .jpeg to .7z) and Extract. sorry for limitation.
another choice you can use socket programming, when bath file finish to transfer, send command to server for execute bath file. I think this 2nd Choice.
I am wondering if it is possible to connect to a git server that is hosted on another server (running Linux) through a C# ASP.NET application. I am only looking for reading capabilities to be able to display information of that git repository in the ASP.NET application.
SharpSSH is really easy to use and i've never had any problems with it, it will let you connect via SSH and run commands, or use SCP to copy files from the server.
I would simply stream the output that a local msysgit command would return.
I want to move the zip file from one server to another server.
What is the best way to do that using C#?
If i am on my local machine running my C# application.
And I want to access two servers server A and serverB using File.COpy() to transfer the file from A to B then it is giving me credential issue.
I don't know whether I have UNC share for both the servers.
I want to use webrequest to transfer the zip file from Server A to Server B from my machine.
If you have a UNC share on the destination server, you can just use
System.IO.File.Copy(String sourceFileLocation,
String destinationFileLocation)
Otherwise you have to simply FTP it.
http://www.devasp.net/net/articles/display/280.html