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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:54:26+00:00 2026-05-13T09:54:26+00:00

I’ve hit a wall on POST’ing data to a webform :( Below is the

  • 0

I’ve hit a wall on POST’ing data to a webform 🙁
Below is the code I’ve adapted from many places (here most recently: http://p2p.wrox.com/asp-net-1-0-1-1-professional/34517-webrequest-webresponse-form-submit-problem-help.html )

Dim url As String = "https://student.ashford.edu/student/"
        Dim data As String = "username=myusername&password=mypassword"
        Dim buffer As Byte() = Encoding.UTF8.GetBytes(data)
        Dim result As String = ""
        Dim req As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
        req.Method = "POST"
        req.ContentType = "application/x-www-form-urlencoded"
        req.ContentLength = buffer.Length
        req.CookieContainer = New CookieContainer()
        ' enable cookies
        Dim reqst As Stream = req.GetRequestStream()
        ' add form data to request stream
        reqst.Write(buffer, 0, buffer.Length)
        reqst.Flush()
        reqst.Close()

        Console.WriteLine(vbLf & "Posting data to " & url)
        Dim res As HttpWebResponse = DirectCast(req.GetResponse(), HttpWebResponse)
        ' send request,get response
        Console.WriteLine(vbLf & "Response stream is: " & vbLf)
        Dim resst As Stream = res.GetResponseStream()
        ' display HTTP response
        Dim sr2 As New StreamReader(resst)
        result = sr2.ReadToEnd()
        Using writer As System.IO.StreamWriter = New StreamWriter("C:\Temp\checkcheck.html")
            writer.Write(result)
        End Using

When I check the checkcheck.html file, it doesn’t show the page I normally see when I’ve successfully logged into my university, but instead shows the login page again prompting for a user name and password. Since it’s prompting for a user/pass in the output response, does that mean nothing is posted? Or is the login button not being hit?

As far as the field names in the source, the name of the username field is “username”, and the name of the password field is “password”. From what I can tell, the name of the login button itself is “submit”. Below is the source of the page, am I missing something?

view-source:https://student.ashford.edu/student/
https://student.ashford.edu/student/

What I want to have happen is that in my VB.NET backend, I click a button and my username and password are automatically entered and I am automagically logged in. Once the login is done, I want to retrieve the HTML of the logged in page so I can parse it for items relating to my studies. This may be unrelated, but do I need cookies to keep my application “logged in” if I navigate to other pages?

EDIT:
I tried plugging different URL’s, to no avail. I have also tried adding submit=login and login=submit (alternately of course) to the POST data. I’m still getting the original login screen HTML from the result variable at the end, instead of my university homepage that I’m expecting after I normally login by hand as a human would. Maybe there is a follow up step that I am missing?

  • 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-13T09:54:27+00:00Added an answer on May 13, 2026 at 9:54 am

    I found out what I needed to do. First I have to make sure that I have a cookie container. Next, I used Fiddler to find out EXACTLY what is being sent back and forth between my browser and where I want to login. I post all the login info, and I get the response back. This seems to fill up my cookie container variable with the required authentication cookies? Next I make another POST request to the page I want to go to, and voila – it works.

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

Sidebar

Ask A Question

Stats

  • Questions 313k
  • Answers 313k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Yes, I have some experience with them - dim and… May 13, 2026 at 10:53 pm
  • Editorial Team
    Editorial Team added an answer I believe this is what Session was designed for -… May 13, 2026 at 10:53 pm
  • Editorial Team
    Editorial Team added an answer I'd document contracts (this parameter is expected not to be… May 13, 2026 at 10:53 pm

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.