简单的问题: 我有一个在线文件 (txt)。如何阅读它并检查它是否存在? (C#.net 2.0)
最佳答案
我认为 WebClient 类适用于此:
WebClient client = new WebClient();
Stream stream = client.OpenRead("http://yoururl/test.txt");
StreamReader reader = new StreamReader(stream);
String content = reader.ReadToEnd();
http://msdn.microsoft.com/en-us/library/system.net.webclient.openread.aspx
关于c# - 如何从互联网上读取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2471209/