[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/07/2009 at 04:43AM PST, ID: 24880330 | Points: 500
[x]
Attachment Details

Web Request help C#

Asked by GVNPublic123 in C# Programming Language

Tags: C#

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(TUsername, TPassword));
                request.Credentials = mycache;
                request.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));

                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...!
[+][-]11/07/09 05:09 AM, ID: 25766178

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/09 06:36 AM, ID: 25766452

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/09 06:53 AM, ID: 25766507

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/09 07:47 AM, ID: 25766661

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/07/09 07:54 AM, ID: 25766708

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/09/09 09:13 AM, ID: 25777857

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_3_20080625