2013-04-23 49 views
0

我想上传视频到我的ASP.net网站到YouTube使用数据API,但我得到这个错误:“远程服务器返回错误:(403)禁止。“上传视频从asp.net网站的YouTube数据api

我使用下面的代码:

YouTubeRequestSettings设置新= YouTubeRequestSettings( “VideoPortal”, “Developer_Key开发”, “用户名”, “口令”); YouTubeRequest请求=新的YouTubeRequest(设置);

视频newVideo = new Video();

 newVideo.Title = "testvideo";//txttitle.Text.Trim(); 
     newVideo.Tags.Add(new MediaCategory("Autos", YouTubeNameTable.CategorySchema)); 
     newVideo.Keywords = "testvideo";//txtkeyword.Text.Trim(); 
     newVideo.Description = "testvideodesc";//txtdesc.Text.Trim(); 
     newVideo.YouTubeEntry.Private = false; 
     newVideo.Tags.Add(new MediaCategory("mydevtag, anotherdevtag", 
      YouTubeNameTable.DeveloperTagSchema)); 

     newVideo.YouTubeEntry.Location = new GeoRssWhere(37, -122); 
     // alternatively, you could just specify a descriptive string 
     // newVideo.YouTubeEntry.setYouTubeExtension("location", "Mountain View, CA"); 
     string path = Server.MapPath("video/Screen-Recording.mov"); 
     newVideo.YouTubeEntry.MediaSource = new MediaFileSource(path, 
      "video/quicktime"); 
     settings.Timeout = 100000000; 
     Video createdVideo = request.Upload(newVideo); 

任何人都可以请我建议我如何使这段代码工作并解决错误?

回答

0

返回HTTP 403响应时,HTTP响应主体的内容是什么?响应正文中应该有一个错误消息,提供解释错误的原因