I have a Uri object being passed to a constructor of my class.
I want to open the file the Uri points to, whether it’s local, network, http, whatever, and read the contents into a string. Is there an easy way of doing this, or do I have to try to work off things like Uri.IsFile to figure out how to try to open it?
It won’t work for whatever. It works for
file://,http://andhttps://andftp://by default. However, you can register custom URI handlers withWebRequest.RegisterPrefixto make it work for those as well.