2

I'm trying to use C#'s HttpWebRequest to get page source based on url.

In the browser, I'm doing this way:

  1. I go to http://brokercheck.finra.org/Search/Search.aspx
  2. Insert a zipcode, say 00501. and do a search.

I am then redirected to http://brokercheck.finra.org/Search/SearchResults.aspx?SearchGroup=Individual&IndlText=&FirmText=&ZipCode=00544&ZipRadius=5&PageNumber=1 This page's html is what I want.

The simple way of using a get method of HttpWebRequest doe not work. It will just get the html of search page.

I then tried to send a post and get cookies and send a get request with the cookies. But still, the response html was the search page's html.

5
  • 1
    What do you want back from that request? Commented Oct 29, 2013 at 17:58
  • neoistheone, I want to get the page source of brokercheck.finra.org/Search/… Commented Oct 29, 2013 at 18:06
  • It's not apparent to me that this is a GET. I would say you really need to analyze what's sent to the server (e.g. headers, body, request type). Commented Oct 29, 2013 at 18:30
  • Try to do a POST Request with these parameters to "Search.aspx" instead of "SearchResults.aspx" Commented Oct 29, 2013 at 18:32
  • I did analyzed see the picture below. Commented Oct 29, 2013 at 18:34

1 Answer 1

3

Use http sniffer tool(WireShark, or HttpWatch) to capture the http request and responses through web browser.

The search.aspx page uses : onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$phContent$ucUnifiedSearch$lbtnFreeFormSearch", "", true, "", "", false, false))" to submit the request.

The SearchResults.aspx page may use some request header information(e.g previos page) to find out if it is a direct access.

You need find out the exact data in the request for SearchResults.aspx.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.