如何读取位于远程服务器上的文件 [英] How can I read a file located on a remote server

查看:401
本文介绍了如何读取位于远程服务器上的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们

我想读取位于服务器上的txt文件,例如http://www.yourwebsite.com/httstats.txt

StreamReader在这里不起作用

我该怎么办?

Hı guys

i want to readt the txt file located in the server like http://www.yourwebsite.com/httstats.txt

StreamReader doesnt work here

what can i do ?

推荐答案



请找到下面的代码,使您能够从互联网读取.txt文件

Hi,

Please find the code below which enables you to read .txt file from the internet

WebClient client = new WebClient();
Stream stream = client.OpenRead("http://www.catonmat.net/download/awk.cheat.sheet.txt");
StreamReader reader = new StreamReader(stream);
String content = reader.ReadToEnd();



问候,
艾哈迈德·曼杜尔(Ahmed Mandour)



Regards,
Ahmed Mandour


这篇关于如何读取位于远程服务器上的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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