如何使用Windows窗体应用程序中的HTTP协议在服务器上读/写文件? [英] How to read/write file on server using HTTP protocol from windows form application?

查看:229
本文介绍了如何使用Windows窗体应用程序中的HTTP协议在服务器上读/写文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows窗体应用程序,它以文本或HTML格式保存日志。我想通过HTTP将此日志保存到位于某个位置的服务器。



例如:



我有一个网站说www.abc.com我有一个窗户在我的客户端使用浏览器控制.net和

访问www.abc.com的表单应用程序现在我想要保存一些页面或想要创建一些文件说明text.xml文件这个服务器(网站所在的www.abc.com)并在某个目录中将一些信息写入该文件。我怎样才能实现这一点。





我不知道如果有任何其他方法。但是,请你帮我解决可行的解决方案。注意我没有对该系统的网络访问权限。

解决方案

一种直接(不推荐)方式是配置读/写权限。 IIS中的文件夹。



https://www.webwiz.co.uk/kb/asp-tutorials/server-permissions.htm



然而,我会推荐给是在您的Web服务器上构建一个Web服务(ASMX,Web API等)以支持读写操作。



你会做什么然后只是通过二进制数据到此Web服务,它将确保将文件写入服务器上的特定位置。



互联网上有足够的例子。例如:



http://stackoverflow.com/questions/16175004/how-to-read-a-text-file-with-a-web-service

I have a windows form application which saves the log in a text or HTML format. I want to save this log to a server located at some place via HTTP.

For eg:

I have a site say www.abc.com and I have a windows form application at my client side from which I am accessing www.abc.com using browser control of .net and
now I want to save some page or want to create some file say text.xml file on this server(www.abc.com where the site is located) and write some information to that file in some directory.How can I achieve this.


I dont know If any other method is there. But could you please help me with feasible solution. Note I do not have a network access to this system.

解决方案

One of the straight forward (and not recommended) way is to configure the read/write permission on a folder within IIS.

https://www.webwiz.co.uk/kb/asp-tutorials/server-permissions.htm

However, what I would recommend to is to build a web service (ASMX, Web API etc.) on your web server to support read and write operations.

What you would do it then just pass the binary data to this web service and it will make sure to write the file on a specific location on server.

There are enough examples of this on internet. For e.g.:

http://stackoverflow.com/questions/16175004/how-to-read-a-text-file-with-a-web-service


这篇关于如何使用Windows窗体应用程序中的HTTP协议在服务器上读/写文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆