469,924 Members | 1,469 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,924 developers. It's quick & easy.

Session Persistance Using System.Net.HttpWebRequest

I'm having trouble porting something from VB 6.0 with
MSXML 4.0 to C# and the .Net framework.

Using MSXML 4.0, I use the HTTPRequest object to get the
following page and obtain a list of parameters from the
search drop-downs (in this case, city names):

http://www.edpa.org/bsc/viewcountyfrommap.asp?
action=search

Using this list, I can retrieve data for each city using
the folowing URL and postdata:

(URL)
http://www.edpa.org/bsc/viewcountyfrommap.asp?

(PostData)
city_code=005&county_code=&cnty_msa_code=&x=9&y=14

I've figured out how to do a "get" for the initial search
page and extract the city information using a regular
expression. The problem I have is "Posting" data to get
the detail page.

Using System.Net.HttpWebRequest, I can send the post data
using a streamwriter. Unfortunately, the website can
somehow determine that I'm attempting to directly request
a detail page without first going to the intitial search
page. It returns a page stating that I'm not logged in.
I looked through the response object thinking that
cookies were used by the website to figure this out. I
was wrong and can't figure out what I need to do so the
website will return a detail page.

How do I retrieve the detail pages for this website by
sending the postdata? It works with MSXML 4.0 because I
can use the same HttpRequest object to hit the search
page and then hit the detail page.

System.Net.HttpWebRequest is different in that once a
request object is used, I can't modify it for sending
postdata. I also tried setting the Referer but haven't
had any luck.

Any advice would be very much appreciated.

Jul 19 '05 #1
0 2721

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jeff | last post: by
3 posts views Thread by Karsten Grombach | last post: by
reply views Thread by Dax Westerman | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.