【发布时间】:2015-07-07 12:14:34
【问题描述】:
我有一个网站,例如 "http://example.com",这里是 settings.ini 文件 "http://example.com/settings.ini" ,在文件中写了这个文本:
[Client]
Enabled=1
我不想从 C# 中给出那个值,有可能吗,怎么做?
例如我正在使用这个代码:
var MyIni = new IniFile(@"C:\settings.ini");
var DefaultVolume = MyIni.Read("Enabled");
MessageBox.Show(DefaultVolume);
效果很好,我正在尝试制作这样的东西:
var MyIni = new IniFile(@"http://example.com/settings.ini");
但它不起作用,谢谢。
编辑:
我收到此错误:
An unhandled exception of type "System.ArgumentException" in mscorlib.dll
For more information: URI formats are not supported.
更新:
此代码从 .ini 中获取所有价值,现在我需要集成到我的旧代码中
WebClient client = new WebClient();
Stream stream = client.OpenRead("http://example.com/settings.ini");
StreamReader reader = new StreamReader(stream);
String content = reader.ReadToEnd();
【问题讨论】:
-
我认为它的文件访问权限相关问题