有没有办法配置 WinForms OpenFileDialog(或其他)来浏览网站 URL 而不是文件?
这个问题说明了一切。
有没有一种方法可以浏览网站链接,以便在选择后从对话框中返回 URL 字符串?
The question says it all.
Is there a way to browse for website links such that, upon selection, it'll return the URL string from the dialog?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不会浏览网站链接,因为网站链接的数量几乎是无限的(您的应用程序如何知道它们是什么?)。相反,您只需创建一个带有文本框的自定义表单并清理输入(将其传递到
Uri
构造函数将为您解析它)。You do not browse for website links since there is an almost infinite number (and how does your application know what they are?). Instead, you can just create a custom form with a textbox on it and sanitize the input (pass it to the
Uri
constructor which will parse it for you).只要 ValidateNames 属性为 false,您就应该能够从 FileName 属性中提取 URL。您仍然需要自行处理获取 URL 中指定的文件。
As long as the ValidateNames property is false, you should be able to pull a URL out of the FileName property. You'll still have to deal with fetching the file specified in the URL on your own.