Error -The server committed a protocol violation in MVC 4
Hi everyone,
First, please you view my code use to upload file to mediafire
public static void uploadFile(string folder_key, HttpPostedFileBase file)
{
System.Net.WebClient Client = new System.Net.WebClient();
Client.Headers.Add("Content-Type", "binary/octet-stream");
string filename = HttpContext.Current.Server.MapPath("~/Images/orderedList1.png");
string UploadURI = "http://www.mediafire.com/api/upload/upload.php?session_token=" + token.session_token + "&uploadkey=" + folder_key + "&response_format=json";
var request = (HttpWebRequest)HttpWebRequest.Create(UploadURI);
var res = Client.UploadFile(UploadURI, "POST", filename);
}
- Red code have error below: "The server committed a protocol violation. Section=ResponseStatusLine". Althought, I inserted code below to web.config:
<configuration>
<system.net>
<settings>
<httpWebRequest useUnsafeHeaderParsing = "true"/>
</settings>
</system.net>
</configuration>
- So how to fixed this error ?
Thank you so very much.
Cheers.
Jimmy Mac.