Click here to Skip to main content
15,909,953 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: (untagged)
Hello folks,

I want to use webrequest or httpwebrequest to login and do some stuff on a website. I understand the basic theory on how to do this, although I haven't done it before.

The main problem is that I don't know which web page is being targeted or what data the POST is submitting. OK, I do know the data put not how to configure it.

Is there some way to monitor the POST request that leaves my machine so I can identify where the request is going and perhaps the data it is sending?

I have tried a few packet sniffers this afternoon but they only seem to monitor the GET and not the POST, which whilst understandable, is annoying.

Thanks for the help.

Arthur
Posted
Updated 9-Apr-10 5:11am
v2

Hi,

The HttpWebRequest class has a Method property that defaults to "GET" but also could be "POST". There is an example on the relevant MSDN page.

:)
 
Share this answer
 
v2
If I understand you correctly, you want to look at the requests a browser sends and then mimic them with a WebRequest?

A packet sniffer is one way, but it will be a lot of work. BTW: All HTTP traffic is on port 80 ( HTTPS is on port 443 ) for both GET and POST requests. The difference is only in the HTTP headers.

It may be easier to write a small website using the same technology as your target site and look at the requests a browser sends to that. You may learn enough to guess what is being sent to your target site for a given event.

Lastly, if the pages are too complex, you're basically going to have to write a browser user agent. How much effort do you want to put into this?

Here's a start:

http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol[^]

Nick
 
Share this answer
 
yeah, thanks Nick. You got my drift and I thought that was going to be the answer :(

I was trying to "hide" the webby stuff in a Class Library, so didn't want to use the Web browser. However, doing it via browser I will have this done in an hour or so, via webrequest probably a week or so.

Oh well, something to add to my (ever expanding) to do list for later. browser it will have to be for now.

Thanks

Art
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900