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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:08:31+00:00 2026-06-15T23:08:31+00:00

I tried to submit form on this site: freeclassifieds , using WebClient that support

  • 0

I tried to submit form on this site: freeclassifieds, using WebClient that support cookies.
My upgraded WebClient:

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

    public CookieWebClient(CookieContainer container)
    {
        this.container = container;
    }

    protected override WebRequest GetWebRequest(Uri address)
    {
        WebRequest res = base.GetWebRequest(address);
        var request = res as HttpWebRequest;
        if (request != null)
        {
            request.CookieContainer = container;
        }
        return res;
    }

    protected override WebResponse GetWebResponse(WebRequest request, IAsyncResult result)
    {
        WebResponse response = base.GetWebResponse(request, result);
        ReadCookies(response);
        return response;
    }

    protected override WebResponse GetWebResponse(WebRequest request)
    {
        WebResponse response = base.GetWebResponse(request);
        ReadCookies(response);
        return response;
    }

    private void ReadCookies(WebResponse r)
    {
        var response = r as HttpWebResponse;
        if (response != null)
        {
            CookieCollection cookies = response.Cookies;
            container.Add(cookies);
        }
    }
}

But when I’m trying to submit form, I just get blocked and receiving the login page as a response.
I checked the cookies and the fields in the login page, everything seems to be tuned up.
Why can’t I receive the right page after success login?

static void Main(string[] args)
    {
        string link1 = "http://www.freeclassifieds.com/logon.aspx";

        string fileName= @"D:\Dropbox\myProjects\AutoPostMachine\myHtml.html";

        CookieWebClient wc = new CookieWebClient(new CookieContainer());

        NameValueCollection postDataCollection= new NameValueCollection();
        postDataCollection.Add("ctl00$phMain$txtEmail", "myEmail");
        postDataCollection.Add("ctl00$phMain$txtPassword","myPassword");
        postDataCollection.Add("ctl00$phMain$btnLogin","Login");

        wc.Encoding = Encoding.UTF8;
        wc.Credentials = CredentialCache.DefaultCredentials;
        wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
        wc.Headers[HttpRequestHeader.Cookie] = "ASP.NET_SessionId=mfqdx1505nnbw3bxws01so12; __utma=19755559.732186057.1355692154.1355692154.1355695835.2; __utmb=19755559.3.10.1355695835; __utmc=19755559; __utmz=19755559.1355692154.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)";

        byte[] byteArr= wc.UploadValues(link1, postDataCollection);
        FileStream fs = new FileStream(fileName, FileMode.Create);
        fs.Write(byteArr, 0, byteArr.Length);

        Process.Start(fileName);
    }
  • 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-15T23:08:32+00:00Added an answer on June 15, 2026 at 11:08 pm

    If/When configured properly, you cannot “spoof” an ASP.Net Web Forms Postback – MSDN ref: VIEWSTATE and EVENTVALIDATION

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

Sidebar

Related Questions

I am working on a drupal site that has a form submit ajax call
I found, on this site a way to submit a POST form without leaving
I have tried to replace the submit button of a form with an ajax
I don't want to submit this app to AppStore. I've tried for many times
I am working on a ASP.NET MVC web site that has multiple submit buttons.
I have a form which automatically refreshes the page on submit, I have tried
I've searched and tried over a dozen suggestions from similar issues on this site,
I need to create c# code to go to site, fill in form submit
So what I want to do is to submit a form using jQuery's AJAX
This is my combined model: public class AddArticleModel { public TBL_ARTICLES Article { get;

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.