I have a php service that generates XML. How can I parse the XML in C#? I tried using something like this:
WebRequest request = WebRequest.Create("http://devstage.jokeroo.com/rest.php"); request.Method = "GET"; request.ContentType = "text/html"; IAsyncResult result = request.BeginGetResponse(RequestCallback, request); private void RequestCallback(IAsyncResult ar) { var request = ar.AsyncState as WebRequest; Stream reader = request.EndGetResponse(ar).GetResponseStream(); //use this reader to read the content } But it keeps throwing this exception:
An exception of type 'System.Net.ProtocolViolationException' occurred in System.Windows.ni.dll but was not handled in user code
Any suggestions?