I working on a windows forms project, visual studio 2010, c#
I want to send some files to computers in our network but they don't have a "listener" as in client/server solution but i do have username/password. Is there any way to send files knowing this information? And as i said, i do not want to build a client / server solution.
Cant i use "Impersonate" somehow?
If you know the username password and your client is within the same domain, you might be able to use UNC with authentication (with $) and send the files to client PC. Something like: \\clientPC\c$. Once authenticated, you can just use File IO, e.g. File.Copy(..."\\clientPC\c$\yourfile.txt") to send file.
You can use the class posted here for UNC authentication.
Is this in the same domain as your machine? If so, do you have the ability to create a share? If you can, you may be able to just setup a share and transfer the files as you would locally. If this is possible there is no point in creating a verbose application for a trivial need.
I built similar for a company I used to work for, the "client" exposed a share and me; the "server" simply used File.Move() to transfer files.
Yes you can use impersonate,
Read this article
, Maybe it will helpful.
Related
I have been working on project recently where eventually I need two (or more) applications on different machines to be able to access the same file on one of them without uploading it to a server first.
Thus, the best idea I could get was to create something like a mini-temporary file server where the desired file path is streamed over the ip address and the other machine can access it via a URL like that "http://xxx.xxx.xxx.xxx/path/file.ext".
I have a good experience with C# but this approach... I never stepped into before, so any help is appreciated either in achieving this approach or any other method that can lead to allowing cross-internet access to a file on a machine.
Thanks in advance.
[Edit]
This operation has to be done without prior port forwarding, I don't know if this is possible, but I guess if it is not then I might need to do something like streaming to a php server first or something, again any help is appreciated.
Set up a virtual directory pointing to a local directory in IIS.
Application A writes file to local directory.
Application B reads
file from http.
Otherwise, you could use a network drive for both applications to read/write from.
I'm looking for a way to establish a simple communication between a c# web application and the operating system.
Since i'm working on Silverlight, i get everything i need to create files into any folder on the C:/ Disk. The problem is that we're going to migrate from Silverlight to Html 5 / C#
So i'd need a way to create files FROM any browser to any OS : Windows,Mac,Linux ..
I thought about using Microsoft Active X but that's not cross platforms.
I'm simply looking for a technology/plugin/software or anything that would allow me to do that, the less client interaction would be the best.
I think your need is in conflict with any common sense about security. If there was a simple way to create any file on any computer that loads your web app, just imagine how quickly all sorts of malware would spread.
But going back to your question - I think it will not be simple (btw. was it really simple in silverlight?). What I can imagine is to have some kind of service running on a client PC (the user would have to install it, or it could be corporate policy if your web app is targeted at corporate solutions). Then the service would listen on some TCP port and your web app could send requests to that port with the intent to create particular file with particular content. All the security concerns would be then implemented in mentioned service so that it doesn't get abused by hostile web apps
I have the following requirement: in an existing webapplication we have a user management. In this you should be able to say for user xyz he should have access to an SFTP-Server lets say with a checkbox option: Allow access to SFTP.
If the option gets selected it should do the following thing:
-> Create a login on the SFTP-Server User: xyz Passwort xzy
-> Create a folder for user /root/xyz with read and write permission (isolated from others)
Anyone has done something similar or an idea how to archive this? What I found so far is .NET FTP authentication which works with IIS (but seems IIS supports only FTP/S not SFTP).
The SFTP is not set up by now, so could be any (prefered on another server)
Would appreciate any help :)
Seems like what you need is an SFTP (thus SSH) server that allows you to create users via some sort of command-line or - better - via remote calls. Depending on the server there may be several ways to do that.
if the server allows you to have SSH shell access (which I would strongly discourage!!) then you could open a shell and on it and use your OS/server command line tools to create/manage user profiles there
if the server has its own CLI (command-line interface) and such CLI allows for remote configuration, then you could invoke it from your web application (make sure permissions allow you to do so) and do it that way
the best way to do it, though, would be to have a server that can be configured via REST API, so you could simply call such REST API from within the context of your web application, and manage your SFTP server's users that way
Since you have not deployed your SFTP server yet, and if you have the liberty to pick any SFTP server you see fit, then you may want to try Syncplify.me Server!, which gives you all 3 options listed above.
(disclaimer: I work at Syncplify)
Often times a program requires a file that happens to be on a network location. Take for instance Outlook. If I where to place an outlooks database (.pst file) in a network location then windows will make that "transparent" to the user and outlook will still be able to work. Another example could be quickbooks and many more. (as long as you have permissions to write and read)
For this example let's use Microsoft Word. If I would want to open a file in some other computer in the network I would be able to navigate to it as:
and open the file that I want because we are on the same network.
Now my question is how will I be able to simulate that? I want to have a virtual directory on the internet where I can place lets say my .pst file and then select it from windows explorer as:
(this example obviously does not work)
Will it be possible to do that? I believe windows uses a tcp connection with the host computer and then the host responds with he files that it shares. I will like to implement a program that does that so that I could avoid having to create a vpn. Also it will be nice if I could have my pst (outlook database file) on the internet so that all my computers open the same outlook database.
Note my purpose of this question is to open an outlook database file on a network location. I will like to be able to select a file on the internet from windows open file dialog. Also in todays world everything pretty much exists. I will like to create it lol
Windows provides a network redirector for CIFS (Common Internet File System, formerly SMB Server Message Block) resources. Writing a CIFS server is the easiest approach.
But you can also use one of the other existing redirectors, such as NFS, WebDAV, or Netware. And it's also possible to write new redirectors (though that requires kernel mode code, there are some development kits that provide the kernel code for you, similar to a Linux FUSE filesystem).
If you want to avoid writing code, WebDAV over HTTPS will provide you secure access (no need for a VPN layer) and software already exists.
It depends on how the server on the internet is set up to make its files available. Most often tcpip is not the protocol used for this - it is FTP, SFTP, HTTP or something similar. I believe Windows Explorer uses RPC calls over a local network to accomplish this. I don't think you will be able to use the Open File Dialog, you will have to write something similar that works over the protocol you need to use.
I am creating a WPF project, and deploying it using ClickOnce. Since the .xbap file is downloaded to the client, and run it from the client machine the client can edit the file and do anyting they wants. That is, if the App.Config file of my WPF appliaction is downloaded along with the .xbap file, and I use some settings to control the behaviour of the application, or use some info like my service detauls, and the user goes to the downloaded location and edits those details they can do anything with it. I have tested this, and this can be done. I have singed my assebmly and manifest with a .pfx certiciate
Since I have signed my assemsbly/manifest, if I perform the same action in the server, the application shows an HashVerification error. Why doesnt this happen in the client side. I think, this is far more important to work in client side then on the server side.
What is the work around to stop users? This could be a serious security issue for many apps. I think this can also be done with Silverlight apps, as it behaves same (not sure if I can paste my modified .xap file to Temporary Internet Folder).
Thanks
Never trust a client.
Whatever you are trying to prevent, expect the user to be an administrator and ready to hack your application.
If you have something to hide (password, connectionstring, ...) do not pass it to the client, keep it on the server.
What is the purpose of settings that cannot be changed by the user?
If you want these values to be constant in the deployed code, then I would consider making them constants or resources.