Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 792517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:00:21+00:00 2026-05-14T22:00:21+00:00

I am trying to login to the TV Rage website and get the source

  • 0

I am trying to login to the TV Rage website and get the source code of the My Shows page. I am successfully logging in (I have checked the response from my post request) but then when I try to perform a get request on the My Shows page, I am re-directed to the login page.

This is the code I am using to login:

    private string LoginToTvRage()
    {
        string loginUrl = "http://www.tvrage.com/login.php";
        string formParams = string.Format("login_name={0}&login_pass={1}", "xxx", "xxxx");
        string cookieHeader;
        WebRequest req = WebRequest.Create(loginUrl);
        req.ContentType = "application/x-www-form-urlencoded";
        req.Method = "POST";
        byte[] bytes = Encoding.ASCII.GetBytes(formParams);
        req.ContentLength = bytes.Length;
        using (Stream os = req.GetRequestStream())
        {
            os.Write(bytes, 0, bytes.Length);
        }
        WebResponse resp = req.GetResponse();
        cookieHeader = resp.Headers["Set-cookie"];
        String responseStream;
        using (StreamReader sr = new StreamReader(resp.GetResponseStream()))
        {
            responseStream = sr.ReadToEnd();
        }
        return cookieHeader;
    }

I then pass the cookieHeader into this method which should be getting the source of the My Shows page:

    private string GetSourceForMyShowsPage(string cookieHeader)
    {
        string pageSource;
        string getUrl = "http://www.tvrage.com/mytvrage.php?page=myshows";
        WebRequest getRequest = WebRequest.Create(getUrl);
        getRequest.Headers.Add("Cookie", cookieHeader);
        WebResponse getResponse = getRequest.GetResponse();
        using (StreamReader sr = new StreamReader(getResponse.GetResponseStream()))
        {
            pageSource = sr.ReadToEnd();
        }
        return pageSource;
    }

I have been using this previous question as a guide but I’m at a loss as to why my code isn’t working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:00:22+00:00Added an answer on May 14, 2026 at 10:00 pm

    Here’s a simplified and working version of your code using a WebClient:

    class Program
    {
        static void Main()
        {
            var shows = GetSourceForMyShowsPage();
            Console.WriteLine(shows);
        }
    
        static string GetSourceForMyShowsPage()
        {
            using (var client = new WebClientEx())
            {
                var values = new NameValueCollection
                {
                    { "login_name", "xxx" },
                    { "login_pass", "xxxx" },
                };
                // Authenticate
                client.UploadValues("http://www.tvrage.com/login.php", values);
                // Download desired page
                return client.DownloadString("http://www.tvrage.com/mytvrage.php?page=myshows");
            }
        }
    }
    
    /// <summary>
    /// A custom WebClient featuring a cookie container
    /// </summary>
    
    public class WebClientEx : WebClient
    {
        public CookieContainer CookieContainer { get; private set; }
    
        public WebClientEx()
        {
            CookieContainer = new CookieContainer();
        }
    
        protected override WebRequest GetWebRequest(Uri address)
        {
            var request = base.GetWebRequest(address);
            if (request is HttpWebRequest)
            {
                (request as HttpWebRequest).CookieContainer = CookieContainer;
            }
            return request;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to mimic the login page from the example http://tipfy-auth.appspot.com (source http://code.google.com/p/tipfy/source/browse/examples/auth/app/ )
I am trying to Login or SugarCrm using REST. I have this code,, //Login
I am trying to login to my JBoss webapp using the example code from
I'm trying to login a user from a controller after the signup. My code
I am trying to login to Way2sms through LWP. The source code of the
I have a page that is trying to login a user. at the top
I'm working on a website located here: http://www.travelanchevacations.com/mainlogin.aspx When trying to login, I get
I am trying to login using the library Mechanize. This the output i get
I'm trying to login automatically in a website using Perl with WWW::Mechanize . What
I am trying to login on my website using MyspaceId running on Android web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.