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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:49:21+00:00 2026-06-10T19:49:21+00:00

with a HTTP request I’m login into the page: https://secure.bodytel.com/de/mybodytel.html . After that I

  • 0

with a HTTP request I’m login into the page: https://secure.bodytel.com/de/mybodytel.html. After that I want to read the settings (https://secure.bodytel.com/de/mybodytel/settings.html). So here’s my problem: I send a second request and the page tells me I’m not logged in anymore. When I debug things with fiddler I saw that I have two different cookie IDs. So, how can I keep the cookie alive? or send it with my request.

I already read this post: “http://stackoverflow.com/questions/11596378/getting-a-page-source-after-post-variables-have-been-sent” but it didn’t helped me very much.

Here’s my code:
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using System.Net;
using System.IO;
using System.Web;

namespace BodytelConnection
{
/// <summary>
/// Interaktionslogik für MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{


    public MainWindow()
    {
        InitializeComponent();
    }


    private void loginBtn_Click(object sender, RoutedEventArgs e)
    {

        #region username stuff
        string benutzername = textBox_benutzername.ToString();
        string passwort = textBox_passwort.ToString();
        passwort = changeString(passwort);
        benutzername = changeString(benutzername);
        #endregion username stuff


        CookieCollection cookies = new CookieCollection();
        CookieContainer container = new CookieContainer();


        #region login
        HttpWebRequest getRequest = (HttpWebRequest)WebRequest.Create("https://secure.bodytel.com/de/mybodytel.html");
        getRequest.Method = WebRequestMethods.Http.Post;
        getRequest.AllowWriteStreamBuffering = true;
        getRequest.AllowAutoRedirect = true;
        getRequest.ContentType = "application/x-www-form-urlencoded";
        byte[] byteArray = Encoding.ASCII.GetBytes("login=" + benutzername + "&password=" + passwort + "&step=login");
        getRequest.ContentLength = byteArray.Length;
        Stream newStream = getRequest.GetRequestStream();
        newStream.Write(byteArray, 0, byteArray.Length);
        newStream.Close();
        HttpWebResponse getResponse = (HttpWebResponse)getRequest.GetResponse();
        StreamReader sr = new StreamReader(getResponse.GetResponseStream());
        // here im trying to save the cookie
        container.Add(getResponse.Cookies);
        getRequest.CookieContainer = container;
        string source = sr.ReadToEnd();
        // save the html
        StreamWriter myWriter = File.CreateText(@"C:\Users\nicholas\Documents\Visual Studio 2010\Projects\BodytelConnection\BodytelConnection\bin\\Debug\test.txt");
        myWriter.Write(source);
        myWriter.Close();
        #endregion login



        //read the settings 
        #region readSettings
        getRequest.Method = WebRequestMethods.Http.Get;
        getRequest = (HttpWebRequest)WebRequest.Create("https://secure.bodytel.com/de/mybodytel/settings.html");         
        getRequest.AllowWriteStreamBuffering = true;
        getResponse = (HttpWebResponse)getRequest.GetResponse();
        sr = new StreamReader(getResponse.GetResponseStream());
        source = sr.ReadToEnd();
        StreamWriter myWriter2 = File.CreateText(@"C:\Users\nicholas\Documents\Visual Studio 2010\Projects\BodytelConnection\BodytelConnection\bin\\Debug\test2.txt");
        myWriter2.Write(source);
        myWriter2.Close();
        getResponse.Close();
        #endregion readSettings
    }

    private string changeString(string myString)
    {

        myString = myString.Replace("System.Windows.Controls.TextBox: ", "");
        return myString;
    }


}

}
  • 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-10T19:49:22+00:00Added an answer on June 10, 2026 at 7:49 pm

    You should be sending cookies with every request, otherwise server has no way of figuring out who is the user

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After an HTTP request has been made in form of e.g. mysite.com/controller/test%20url , With
In http://nodejs.org/docs/v0.4.7/api/http.html#http.request There is an example that fetches some web content, but how does
I want to find location of http request that are coming from many countries.
How many http request does a browser can handle in a single html page.
I have an http request that worked as http://blah.com and now I have been
I have an HTTP Request Dispatcher class that works most of the time, but
So I use apache HttpComponents to handle http request in java. Now I want
I want to create a HTTP request from a specific port using C on
I have set up several http request samplers in Jmeter that have either get
I have a http request call that return a url . If I run

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.