Hello,
What I am trying to do is use YouTube API in order to gather some susbscription information (see
http://code.google.com/apis/youtube/2.0/developers_guide_dotnet.html#Retrieving_a_Subscription)
So what I do is:
string url = "
http://gdata.youtube.com/feeds/api/users/" + TUsername + "/subscriptions";
WebRequest request;
try
{
Application.DoEvents();
request = WebRequest.Create(url);
string usernamePassword = TUsername + ":" + TPassword;
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(url), "Basic", new NetworkCredential(TUsernam
e, TPassword));
request.Credentials = mycache;
request.Headers.Add("Autho
rization",
"Basic " + Convert.ToBase64String(new
ASCIIEncoding().GetBytes(u
sernamePas
sword)));
WebResponse response = request.GetResponse();
Stream receiveStream = response.GetResponseStream
();
StreamReader reader = new StreamReader(receiveStream
, Encoding.UTF8);
content = reader.ReadToEnd();
But it returns me 401 unauthorized error...
Im new to YouTube API, so please help me what I am doing wrong...!