The following code breaks when the XML has data like "Lord & Hogan". Any suggestions? Thanks, Ken
private T GetResponse<T>(String apiObject, String query)
{
//Deserialize XML into the type specified.
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(BuildRequestUri(apiObject, query));
using (HttpWebResponse resp = (HttpWebResponse)request.GetResponse())
{
try
{
XmlSerializer ser = new XmlSerializer(typeof(T));
return (T)ser.Deserialize(resp.GetResponseStream());
}
catch (Exception e)
{
error = e.InnerException.ToString();
return default(T);
}
}
}