I’m fairly new to using WebRequests in C# and would like some help logging into YouTube and storing cookies into a cookie container. Any help would be much appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using the .NET client library (http://code.google.com/p/google-gdata/) then it will take care of authenticating for you when needed using the credentials you provided:
https://developers.google.com/youtube/2.0/developers_guide_dotnet#Authentication
GData in C#
When using the GData API there’s no explicit logout method, you can invalidate your token but it will also expire after some time if you don’t use it. Specific details on how to invalidate the token differ according to the authentication mechanism adopted (OAuth, AuthSub, ClientLogin).
You can also refer to this article on CodeProject, Manage YouTube using C# and Youtube API 1.6
ADDED: I have tweaked below code to match your requirement.
Reference: http://social.msdn.microsoft.com/Forums/pl-PL/ncl/thread/40d249b5-a9ad-4068-8853-629fb20584a0