简体   繁体   English

将文本文件保存到远程网络共享文件夹,例如https://

[英]Save a text file to a remote network shared folder like https://

My client provides a network shared folder in the format of https://xxxx with user name and pwd. 我的客户端以用户名和pwd的https:// xxxx格式提供了一个网络共享文件夹。 I need to write a console application to put a text file there. 我需要编写一个控制台应用程序以在其中放置文本文件。 Is there any .Net class or library available? 是否有可用的.Net类或库? I prefer open source lib if available. 我更喜欢开源库(如果有)。

By the way, I can see the shared folder from Windows File Explorer: My Computer->My Network Places 顺便说一句,我可以从Windows文件资源管理器中看到共享文件夹:“我的电脑”->“网上邻居”

You might want to take a look at 您可能想看看

HTTP put - that's the first thing that came to mind. HTTP放置-这是我想到的第一件事。 An example can be seen here:: 一个例子可以在这里看到:

http://www.java2s.com/Code/CSharp/Network/HTTPputwithusernameandpassword.htm http://www.java2s.com/Code/CSharp/Network/HTTPputwithusernameandpassword.htm

it looks like it might be a webdav server. 看起来可能是一台webdav服务器。 you can take a look at this question here if it helps: Open source library in c# to communicate with a WebDAV server 您可以在这里查看是否有帮助的问题: c#中的开放源代码库以与WebDAV服务器通信

You need a command line tool to POST a file to some URL, right? 您需要命令行工具才能将文件发布到某个URL,对吗? What about 关于什么

>curl --data-binary /usr/xzy/testfile -u user:passwd https://xxx

In essence curl is a tool that allows to reproduce literally any HTTP request that you might possibly need to send. 本质上讲curl是一个工具,它可以从字面上重现您可能需要发送的任何HTTP请求。 However, it's a unix/linux tool and you might need cygwin to run it on a Windows machine. 但是,这是一个Unix / Linux工具,您可能需要cygwin才能在Windows计算机上运行它。

On a linux environment your task might be reduced to writing a UI that triggers curl as external command. 在linux环境中,您的任务可能简化为编写可触发curl作为外部命令的UI。

If for nothing else, curl might be a great debugging/testing tool for your developement. 如果没有其他要求,curl可能是您进行开发的绝佳调试/测试工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM