2013-04-23 63 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響應主體的內容是什麼?響應正文中應該有一個錯誤消息,提供解釋錯誤的原因