473,404 Members | 2,187 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,404 software developers and data experts.

Programatically Login

I'm trying to scrape a page that requires me to login to it. I'm not sure
if it uses cookies or not to track if I'm logged in, could it be using
viewstate?

Anyway, can I do this using the HttpRequest and HttpResponse methods?

I didn't see anything on google groups about this that was of any help.
Does anybody have a C# snippet that might put me on the right path?

Zack
Nov 17 '05 #1
3 1597
Yes, it could use view state or session state, or cookies to track whether
you are logged in.

If it is view state or session state, then you can enter the information on
the login page and it will track you until your session ends.

If it is a cookie, then when you login you will have to capture the cookie
and send it in subsequent requests. You will also have to worry about the
expiration and/or the system rejecting or not using your cookie. In other
words, if you go directly to a URL and you are redirected to a login page,
your program will have to be smart enough to know which page it got and what
to do based on the page.

Also, what if they simply change the login and/or other pages? How will you
know if they changes a page, and for example added a new field between
username and password called favorite color to the form?

Hope this helps...

Frisky

"Zachary Burns" <za**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm trying to scrape a page that requires me to login to it. I'm not sure
if it uses cookies or not to track if I'm logged in, could it be using
viewstate?

Anyway, can I do this using the HttpRequest and HttpResponse methods?

I didn't see anything on google groups about this that was of any help.
Does anybody have a C# snippet that might put me on the right path?

Zack

Nov 17 '05 #2
Ok. I found out it is a cookie and that is getting passed around after I
log in.

Is there a way to capture a cookie and pass it around using
WebRequest/Response once I log in?

Zack

"Frisky" <Fr***********@NorthPole.Net> wrote in message
news:O3**************@TK2MSFTNGP15.phx.gbl...
Yes, it could use view state or session state, or cookies to track whether
you are logged in.

If it is view state or session state, then you can enter the information
on the login page and it will track you until your session ends.

If it is a cookie, then when you login you will have to capture the cookie
and send it in subsequent requests. You will also have to worry about the
expiration and/or the system rejecting or not using your cookie. In other
words, if you go directly to a URL and you are redirected to a login page,
your program will have to be smart enough to know which page it got and
what to do based on the page.

Also, what if they simply change the login and/or other pages? How will
you know if they changes a page, and for example added a new field between
username and password called favorite color to the form?

Hope this helps...

Frisky

"Zachary Burns" <za**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm trying to scrape a page that requires me to login to it. I'm not
sure if it uses cookies or not to track if I'm logged in, could it be
using viewstate?

Anyway, can I do this using the HttpRequest and HttpResponse methods?

I didn't see anything on google groups about this that was of any help.
Does anybody have a C# snippet that might put me on the right path?

Zack


Nov 17 '05 #3
Yes.

Use HttpResponse.Cookies
(http://msdn.microsoft.com/library/de...okiestopic.asp)
to get the cookies from the page. Once you capture them, use
HttpRequest.Cookies
(http://msdn.microsoft.com/library/de...okiestopic.asp)
to send them back to the page or to send them to page initially to keep from
having to log in.

What each cookie does, and what data it stores is application independent.
So, you won't be able to interpret their cookies. However, whatever cookies
you get back in a response, you will most likley need to send back to them
in each request. Even if this is on a different day for a brand new request.
Normally, the browser would do this for you. But, if you are going to play
browser, you must store the cookies and use them later when you call the
page again.

Frisky

"Zachary Burns" <za**********@hotmail.com> wrote in message
news:Om**************@TK2MSFTNGP09.phx.gbl...
Ok. I found out it is a cookie and that is getting passed around after I
log in.

Is there a way to capture a cookie and pass it around using
WebRequest/Response once I log in?

Zack

"Frisky" <Fr***********@NorthPole.Net> wrote in message
news:O3**************@TK2MSFTNGP15.phx.gbl...
Yes, it could use view state or session state, or cookies to track
whether you are logged in.

If it is view state or session state, then you can enter the information
on the login page and it will track you until your session ends.

If it is a cookie, then when you login you will have to capture the
cookie and send it in subsequent requests. You will also have to worry
about the expiration and/or the system rejecting or not using your
cookie. In other words, if you go directly to a URL and you are
redirected to a login page, your program will have to be smart enough to
know which page it got and what to do based on the page.

Also, what if they simply change the login and/or other pages? How will
you know if they changes a page, and for example added a new field
between username and password called favorite color to the form?

Hope this helps...

Frisky

"Zachary Burns" <za**********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
I'm trying to scrape a page that requires me to login to it. I'm not
sure if it uses cookies or not to track if I'm logged in, could it be
using viewstate?

Anyway, can I do this using the HttpRequest and HttpResponse methods?

I didn't see anything on google groups about this that was of any help.
Does anybody have a C# snippet that might put me on the right path?

Zack



Nov 17 '05 #4

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

Similar topics

6
by: batham | last post by:
Hello Gurus, Can someone direct me to the right path. Using C# to create a web service, how can I programatically log in a web site (with a valid username and password) and navigate to a...
3
by: Pete | last post by:
Using C# and a web browser control, is there a way to programatically click a web page button?
2
by: Antonio Dias | last post by:
Hi all, I'm hoping someone can help me with this question: I'm building a winforms .net application which is going to use a web service with https. I have a certificate protected in a ...
2
by: Chris Dunaway | last post by:
I need to be able to start and stop a service on another computer on the network. But I cannot connect to the other computer using my standard user credentials. I have a separate login for that...
2
by: Ofer | last post by:
Hi, We use the ASP.net loginControls and the DB schema. How to programmatically activate the "PasswordRecovery" of a specific end-user when a user clicks my web application's button? I need to...
6
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in...
2
by: Grey Alien | last post by:
I am trying to programatically POST an ASP form, to allow me to log on to a site programatically. <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> <input...
4
by: Mick Walker | last post by:
Hi All, I have a situation where I am using a login control to log a user in to my web app. Under the LoginButton_Click handler of the login control, I retrive some custom user information from...
0
by: hikmaverick | last post by:
Hi all, the title of my topic is a copy from an old message posted by Grey Allen, about twenty days ago. As Grey, I am trying to programatically POST an ASP form, to allow me to log on to a site...
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: 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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.