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

  • Home
  • SEARCH
  • 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 6530489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:45:42+00:00 2026-05-25T09:45:42+00:00

Alright, so I’ve got a function I wrote that should allow me to post

  • 0

Alright, so I’ve got a function I wrote that should allow me to post data with cookies. The problem is is I’m testing it out on an Amazon login page, and it keeps responding saying I need cookies enabled. Here’s the code

public string DoPost(String url, PostData data, CookieContainer cookies)
{
    HttpWebRequest objWebRequest = (HttpWebRequest)WebRequest.Create(url);
    objWebRequest.CookieContainer = cookies;
    objWebRequest.AllowAutoRedirect = true;
    objWebRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
    if(data != null)
    {
        String post = data.ToString();
        objWebRequest.Method = "POST";
        objWebRequest.ContentLength = post.Length;
        objWebRequest.ContentType = "application/x-www-form-urlencoded";
        // Post to the login form.
        using(StreamWriter swRequestWriter = new StreamWriter(objWebRequest.GetRequestStream()))
        {
            swRequestWriter.Write(post);
        }
    }

    // Get the response.
    HttpWebResponse objWebResponse =
         (HttpWebResponse)objWebRequest.GetResponse();

    // Read the response
    using(StreamReader srResponseReader = new StreamReader(objWebResponse.GetResponseStream()))
    {
        string strResponseData = srResponseReader.ReadToEnd();
        return strResponseData;
    }
}

And I call it like this

String action = "https://www.amazon.com/gp/flex/sign-in/select.html";
String s = DoPost(action, null, Cookies);

Cookies is created in my class constructer like this

CookieContainer Cookies;

public Constructz0r()
{
    Cookies = new CookieContainer();
}

The thing is, I’m not even posting any post data, I’m just going to the page, and it’s saying my cookies aren’t enabled, though I feel I’ve done it write in DoPost.

I’ve even tried using this implementation of WebClient

    public class CookieWebClient : WebClient
    {
        private CookieContainer _cookieContainer = new CookieContainer();

        protected override WebRequest GetWebRequest(Uri address)
        {
            WebRequest request = base.GetWebRequest(address);
            if (request is HttpWebRequest)
            {
                (request as HttpWebRequest).CookieContainer = _cookieContainer;
            }
            return request;
        }
}

And calling it like this

        using(CookieWebClient ck = new CookieWebClient())
        {
            String s =  ck.DownloadString(action);
        }

And it still tells me the cookies aren’t enabled.

  • 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-25T09:45:42+00:00Added an answer on May 25, 2026 at 9:45 am

    Amazon have an API to access their services (SOAP). So instead of trying to do some scraping I would strongly recommend you using their API.

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

Sidebar

Related Questions

Alright, I found out in this question that polling sockets does not scale, so
Alright. So I figure it's about time I get into unit testing, since everyone's
Alright, currently I have my SWF hitting a php file that will go and
Alright. So I have a very large amount of binary data (let's say, 10GB)
Alright, I'm trying to read a comma delimited file and then put that into
Alright, I know how the fieldset / legend works out in HTML. Say you
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, I'm trying to understand follow sets and I think I got it except
Alright I'm going to create a fairly complex form to post via AJAX a

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.