The given path's format is not supported using File.ReadAllText

I have a WPF application. I am loading some data from XML file.

I receive an error:

System.NotSupportedException was unhandled
Message: The given path's format is not supported.

on this line:

string html = File.ReadAllText(Advertisement.DescriptionUrl);

the url in the xml it is:

http://mysitetest.com/x/x/Assets/shop/shopdetails/Coffee/image.png

Any ideas how to fix it?

Jon Skeet
people
quotationmark

File.ReadAllText is meant to take a filename on a file system - not a URL.

You'll need to fetch it with something like WebClient.DownloadString:

string text;
using (WebClient client = new WebClient())
{
    text = client.DownloadString(url);
}
// Now use text

people

See more on this question at Stackoverflow