I write the code to post the video into my flow player account but i am getting an error saying that <pre lang="c#">System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse()
try { string data = ""; User PostVideo = new User(); //PostVideo.authcode = ObjUser.authcode; PostVideo.SourceURL = (Server.MapPath("~/" + lblVideoFilePath.Text.ToString())); PostVideo.free = true; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://drive.api.flowplayer.org/jobs"); WebHeaderCollection myWebHeaderCollection = request.Headers; myWebHeaderCollection.Add("flowplayer-authcode", ObjUser.authcode); request.Method = "POST"; request.ContentType = "application/json"; var userSerialized = JsonConvert.SerializeObject(PostVideo); // <— This is JSON.NET; it works (userSerialized has the JSONized versiono of the User object created above) using (StreamWriter sw = new StreamWriter(request.GetRequestStream())) { sw.Write(userSerialized); sw.Flush(); } using (var httpWebResponse = request.GetResponse() as HttpWebResponse) { if (httpWebResponse != null) { using (var streamReader = new StreamReader(httpWebResponse.GetResponseStream())) { data = streamReader.ReadToEnd(); } } return data; } } catch (Exception e) { Response.Write(e); return ""; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)