473,379 Members | 1,255 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

HttpWebRequest configured with Method "POST" still generating "GET

I have been working on a little project in C# to log into a website (using
code inspired/riipped from
http://www.codeproject.com/cs/intern...ivejournal.asp) but when I
request the response, the packet that is sent out is an HTTP GET (I'm
watching the outgoing packet via Ethereal). The code I'm using is identical
to that above, only configured for the site I'm trying to communicate with.

Are there any ideas out there for why a HttpWebRequest wouldn't "POST" when
you've clearly told it to post, and when you've given it properly formatted
content to post?

Any help would be much appreciated.
Jul 23 '06 #1
2 1854
ReGex <Re***@discussions.microsoft.comwrote:
I have been working on a little project in C# to log into a website (using
code inspired/riipped from
http://www.codeproject.com/cs/intern...ivejournal.asp) but when I
request the response, the packet that is sent out is an HTTP GET (I'm
watching the outgoing packet via Ethereal). The code I'm using is identical
to that above, only configured for the site I'm trying to communicate with.
Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 23 '06 #2
After further analyzing the packet data going out (and trying the same code,
although targeted at a different server) I noticed that the HttpWebRequest
was attempting to discourse with the server *prior* to the post event.
Apparently it was trying to negotiate whether it was the right place to send
a post, before actually sending it (and in this case the server was saying
no, because it sends a 302 redirect back on post). By switching off the
static member System.Net.ServicePointManager.Expect100Continue, it now posts
to the server as expected. (* see
http://haacked.com/archive/2004/05/15/449.aspx for a more thorough discussion
of this problem *)

However, now that it's posting, the posting isn't working as expected, but
at least I can debug that :)

"Jon Skeet [C# MVP]" wrote:
ReGex <Re***@discussions.microsoft.comwrote:
I have been working on a little project in C# to log into a website (using
code inspired/riipped from
http://www.codeproject.com/cs/intern...ivejournal.asp) but when I
request the response, the packet that is sent out is an HTTP GET (I'm
watching the outgoing packet via Ethereal). The code I'm using is identical
to that above, only configured for the site I'm trying to communicate with.

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Jul 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Rui Pestana | last post by:
Hello all, I want to use the POST method to submit the form and then grab the parameters in the asp file with request.form("parm"). The problem is that I am using the _search target to open...
1
by: Pete Mahoney | last post by:
Ok I use a textarea to store data input by the user, and then upon them clicking the submit button I store this data to a database. The problem is once the user inputs too much data (about 3...
1
by: brian | last post by:
i have a form processing being done by an asp page which works ok with "GET". two text inputs are sent and processing is done by an asp page which outputs the two values. with GET both values...
2
by: Jason Morehouse | last post by:
Hello, Anyone know if it's possible to speak with the server via xmlhttp.open while the browser is doing a post -- file upload in this case: <form enctype="multipart/form-data"...
12
by: Assaf | last post by:
Hi all, My client is using an online service provider that processes survey responses. After a user fills survey.aspx and presses the OK button, 2 things need to happen: 1. the data has to...
5
by: Jeff | last post by:
Visual Studio 2003 DotNet framework 1.1 Windows 2000 Pro I create two pages in an Asp.net application, one is html page with a form in it: .... <form id="testForm" method="post"...
6
by: James MA | last post by:
I'm now writing a small program to communicate a web server to simulate a web client. I use te httpwebrequest to talk with the server, and it works find for "POST" method, however, when i test...
14
by: Robert S | last post by:
I am trying to use POST to transfer data to another page. When I do this, '.' characters get converted to"_". For example: #index.html: <form action="test.php" method="post"> <input...
1
by: Jim Carlock | last post by:
Let's not argue about semantics. Let's talk about semasiology. Do specifications exist for using mixed case, upper case, lower case for the contents of the method employed? My own preferences...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.