v f

v f

  • NA
  • 3
  • 0

The server committed a protocol violation

Aug 18 2006 11:14 AM
I am using this Code for reading Image from URL

private Image getImage(string url)
{
Image im = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Method = "GET";
request.Timeout = 15000;
request.ProtocolVersion = HttpVersion.Version11;

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
using (Stream responseStream = response.GetResponseStream())
{
im = Image.FromStream(responseStream);
}
}
}
catch (Exception ex)
{
Debug.WriteLine("Exception in getThumbnail. Url: " + url + ". Info: " + ex.Message + Environment.NewLine + "Stack: " + ex.StackTrace);
}
return im;
}


but if the URL like this

http://mud.mm-a5.yimg.com/image/1942583882

the code will not work correctly.

How I can Fixed it ?


this message display after click the Button

Exception System.Net.WebException was thrown in debuggee:
The server committed a protocol violation. Section=ResponseStatusLine