简体   繁体   English

错误:不支持URI格式。 C#

[英]Error: URI formats are not supported. c#

My code here: 我的代码在这里:

        StreamReader sr;
        sr = File.OpenText(@"http://k1.besaba.com/Lic.rtf");

        richTextBox1.Rtf = sr.ReadToEnd();
        sr.Close();

Why error Additional information: URI formats are not supported. 为什么出错附加信息:不支持URI格式。 Please help me. 请帮我。 Thank you. 谢谢。 Image here: http://i.stack.imgur.com/51at6.png 图片在这里: http : //i.stack.imgur.com/51at6.png

File.OpenText() is meant to open a file stored locally on the file system. File.OpenText()用于打开本地存储在文件系统上的文件。 You would want to do something like this: 您可能想要执行以下操作:

var webClient = new WebClient(); //Make sure to reference System.Net
richTextBox1.Rtf = client.DownloadString("http://k1.besaba.com/Lic.rtf");

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

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