Illegal characters in path error while parsing XML in C#

The reason why is you are using the constructor of XmlTextReader which takes a file path as the parameter but you're passing XML content instead.

Try the following code

XmlTextReader reader = new XmlTextReader(new StringReader(strURL));

XmlTextReader constructor accepts a string that points to the URL where an XML file is stored. You are passing it the XML itself which of course is an invalid path. Try this instead:

using (var client = new WebClient())
{
    var xml = client.DownloadString("http://api.tr.im/api/trim_url.xml?url=" + HttpUtility.UrlEncode(txtURL.Text));
    using (var strReader = new StringReader(xml))
    using (var reader = XmlReader.Create(strReader))
    {

    }
}

The XmlTextReader(string) constructor expects a file path, not the actual XML data.

You can create an XML reader directly from the stream. The recommended way to do this is using the XmlReader.Create method:

XmlReader reader = XmlReader.Create(objStream);