How to fix "illegal characters in path when converting an XML . . ." exception?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Malith Wickrama
    New Member
    • Jan 2011
    • 1

    #1

    How to fix "illegal characters in path when converting an XML . . ." exception?

    Hi,

    I have to send an XML file to a web url with an HTTP POST. This XML file does contain an audio clip that has been converted into base64 file format. Before I send this file as an HTTP POST I have to convert this to string. When I try to convert the file to a string it gives me an exception.


    Code:
    private string GetTextFromXMLFile(string filePath)
        {
            try
            {
                StreamReader streamReader = new  StreamReader   (filePath);
                string returnDataStream = streamReader.ReadToEnd();
                streamReader.Close();
                return returnDataStream;
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
                return null;
            }
        }
    I would be grateful if someone can help out in this.

    Thanks
    Last edited by Niheel; Jan 18 '11, 04:53 AM.
Working...