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 8264083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:19:57+00:00 2026-06-08T04:19:57+00:00

I’m trying to connect to another user page after I logged in using HttpWebRequest

  • 0

I’m trying to connect to another user page after I logged in using HttpWebRequest. But when I try it, it connects as not logged in. Does it have to do with cookies?

req = (HttpWebRequest)HttpWebRequest.Create("http://www.elitepvpers.com/forum/login.php?do=login");
req.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20100101 Firefox/13.0.1";
req.Method = "POST";
req.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
req.Headers.Add("Accept-Language: tr-tr,tr;q=0.8,en-us;q=0.5,en;q=0.3");
req.KeepAlive = true;
req.Referer = "Referer: http://www.elitepvpers.com/theblackmarket/treasures/";
req.ContentType = "application/x-www-form-urlencoded";
string id = "username";
string pw = "*****";
StreamWriter sw = new StreamWriter(req.GetRequestStream());
sw.Write("vb_login_username=" + id + "&vb_login_password=" + pw + "&cookieuser=1&s=&securitytoken=1342962102-8aa76183509ebade0188ac49c3c84470ff2aabba&do=login&vb_login_md5password=&vb_login_md5password_utf=");
response = (HttpWebResponse)req.GetResponse();
  • 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-06-08T04:19:59+00:00Added an answer on June 8, 2026 at 4:19 am

    Here this code solves the problem, you should add an CookieContainer to your request to handle the session. The site returned a html containning “Thank you for logging in, eferek”, and now the sessionID is stored in our CookieContainer, so every time you create a new request use the same CookieContainer and you will have the same session at the site.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.IO;
    using System.Net;
    
    namespace del2
    {
        class Program
        {
            static void Main(string[] args)
            {
    
                HttpWebRequest request = GetNewRequest("http://www.elitepvpers.com/forum/login.php?do=login", cookies);
    
    
                string id = "efeerk";
                string pw = "trgamer";
                Dictionary<string,string> parameters = new Dictionary<string,string>{{"vb_login_username",id},{"vb_login_password",pw},
                    {"cookieuser","1"},{"s",""},{"securitytoken","1342962102-8aa76183509ebade0188ac49c3c84470ff2aabba"},
                    {"do","login"},{"vb_login_md5password",""},{"vb_login_md5password_utf",""}};
    
    
                HttpWebResponse response = MakeRequest(request, cookies, parameters);
                using (StreamReader reader = new StreamReader(response.GetResponseStream()))
                {
                    if(!reader.EndOfStream)
                    {
                        Console.Write(reader.ReadToEnd());
                    }
                }
    
                Console.Read();
    
            }
    
            static CookieContainer cookies = new CookieContainer();
    
            static HttpWebRequest GetNewRequest(string targetUrl, CookieContainer SessionCookieContainer)
            {
                HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(targetUrl);
                request.CookieContainer = SessionCookieContainer;
                request.AllowAutoRedirect = false;
                return request;
            }
    
            public static HttpWebResponse MakeRequest(HttpWebRequest request, CookieContainer SessionCookieContainer, Dictionary<string, string> parameters = null)
            {
    
    
                request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.52 Safari/536.5Accept: */*";
                request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8";
                request.CookieContainer = SessionCookieContainer;
                request.AllowAutoRedirect = false;
    
                if (parameters != null)
                {
                    request.Method = "POST";
                    request.ContentType = "application/x-www-form-urlencoded";
                    string postData = "";
                    foreach (KeyValuePair<String, String> parametro in parameters)
                    {
                        if (postData.Length == 0)
                        {
                            postData += String.Format("{0}={1}", parametro.Key, parametro.Value);
                        }
                        else
                        {
                            postData += String.Format("&{0}={1}", parametro.Key, parametro.Value);
                        }
    
                    }
                    byte[] postBuffer = UTF8Encoding.UTF8.GetBytes(postData);
                    using (Stream postStream = request.GetRequestStream())
                    {
                        postStream.Write(postBuffer, 0, postBuffer.Length);
                    }
                }
                else
                {
                    request.Method = "GET";
                }
    
    
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                SessionCookieContainer.Add(response.Cookies);
    
    
                while (response.StatusCode == HttpStatusCode.Found)
                {
                    response.Close();
                    request = GetNewRequest(response.Headers["Location"], SessionCookieContainer);
                    response = (HttpWebResponse)request.GetResponse();
                    SessionCookieContainer.Add(response.Cookies);
                }
    
    
                return response;
            }
    
    
    
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I need to clean up various Word 'smart' characters in user input, including but
I'm making a simple page using Google Maps API 3. My first. One marker
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.