Click here to Skip to main content
15,898,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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()


Below is the my code Please suggest me the changes to upload video to my flow player account

C#
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 "";
}

the Source URL is :
D:\MyWebsite\WebSite\Resources\Videos\whatisxmlindotnet-34382b2e-d1d3- 447b-bf71-0f190e231fbf.mp4

Please help me...!
here is a link to the API documentation that i am using
Drive API documentation[^]
Posted
Updated 25-Jan-16 18:48pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900