Get data from another website.

M

Manuel

I need to go to another website, login with a username/password and
retrieve a page.

The problem is that the site keeps track of the user with a session
variable + cookies.

I've done this in VB using the MS WebBrowser, Navigating to the login
page, setting the values of the textboxes and hitting
theSubmitButton.Click()
Then I just have to retrieve the data from the WebBrowser.

How can I do this in ASP.NET? Or some other way...
 
J

jongalloway

I recommend using Fiddler to watch exactly what's sent to and from the
server as you log in to the web page:
http://www.fiddlertool.com/fiddler/

Then you can use the HttpRequest method to post to the page and read
the response. You can then post or get other pages in the site.

Session variables are stored on the server, so you can't and won't need
to track them. You will probably need to get and set headers and
cookies, which are accessible via the HttpRequest / Response Headers
and Cookies collections:
http://msdn.microsoft.com/library/d...rlrfsystemwebhttprequestclassheaderstopic.asp
http://msdn.microsoft.com/library/d...rlrfsystemwebhttprequestclasscookiestopic.asp
- Jon
http://weblogs.asp.net/jgalloway
 
V

vMike

Manuel said:
I need to go to another website, login with a username/password and
retrieve a page.

The problem is that the site keeps track of the user with a session
variable + cookies.

I've done this in VB using the MS WebBrowser, Navigating to the login
page, setting the values of the textboxes and hitting
theSubmitButton.Click()
Then I just have to retrieve the data from the WebBrowser.

How can I do this in ASP.NET? Or some other way...

You may want to take a look at this write up

http://www.west-wind.com/presentations/dotnetwebrequest/dotnetwebrequest.htm

Mike
 
J

Joe Fallon

That is an excellent reference!
I used it awhile back and it actually worked.
Good explanation as to what is going on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top