Sant Roy

Sant Roy

  • 1.6k
  • 122
  • 29.9k

The remote server returned an error: (403) Forbidden

Dec 23 2016 3:34 AM
i am trying to upload video in youytube from my c# project
here is my design page
 
 
here is my code behind 
protected void btnsubmit_Click(object sender, EventArgs e)
{
YouTubeModel youtubeModel;
YouTubeRequestSettings settings;
YouTubeRequest request;
string devkey = "AIzaSyBzFdJApkJnjh6LCGpY-IIAku3dsjE5T3A";
string filename = Path.GetFileName(fileupload.FileName);
fileupload.SaveAs(Server.MapPath("~/App_Data") + filename);
string path = Server.MapPath("~/App_Data") + filename;
string filepath = Path.GetFullPath(path);
settings = new YouTubeRequestSettings("youtube", "535208901500 - 4f57lvr1vnequ7f3dqalug3eejj351c0.apps.googleusercontent.com", devkey);
request = new YouTubeRequest(settings);
settings.Timeout = 1000000000;
Video video = new Video();
video.Title = "Sample Video Title";
video.Description = "Sample Video Description";
video.Tags.Add(new MediaCategory("Comedy", YouTubeNameTable.CategorySchema));
video.Keywords = "Comedy";
video.Private =false;
video.MediaSource = new MediaFileSource(filepath, "video/quicktime");
Video createdVideo = request.Upload(video);
}
 i have used namespaces like that
 
using Google.GData.Extensions;
using Google.GData.Client;
using Google.GData.YouTube;
using Google.GData.Extensions.MediaRss;
using Google.YouTube;
 
 i already installed google Api v3 and i already generated ClientId key and Developer key 
what is the problem??i have already searched in google but unable to get proper solution..what should i do for solving this problem??can anyone help me please??? 
 

Answers (1)