1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[VB.NET] HTTP Stay online for ever on site

Discussion in 'Visual Basic .NET' started by healzer, Dec 31, 2011.

  1. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    Hello

    I've been searching all through & googling for hours & cannot find what I'm looking for:

    I have a website where I register, etc... & then I login to it (works fine with httpwebrequest/response/streamwrite/cookies ~~all good). But then on the website you can see if the member is offline or online.

    How can I create a backgroundProcess or anything similar which enables me to stay online for ever (long time).
    I don't want to do this with a webbrowser because I intend to create a bot (so it'll be running 10 - 100 of those accounts with proxies).

    Hope to hear any tips or hints on how to achieve this.

    Kind Regards

    & A happy NEW YEAR !!!!
     
  2. paincake

    paincake Power Member

    Joined:
    Aug 18, 2010
    Messages:
    716
    Likes Received:
    3,099
    Home Page:
    Occasionaly send a request to the site with your session cookie included.

    You'd have to save and store your cookies somewhere.

    Code:
    cookieContainer = new CookieContainer();
    request.CookieContainer = cookieContainer;
     
  3. Nookie Monster

    Nookie Monster Senior Member

    Joined:
    Mar 28, 2010
    Messages:
    968
    Likes Received:
    463
    Location:
    USA
    You guys that can code amaze me. I fell behind when I stopped coding in QuickBasic back in the DOS days.

    Damn what and education I didn't get...
     
    • Thanks Thanks x 1
  4. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    I store cookies, yes, I use fiddler2 to see the data being sent.

    Whenever I sent / receive data to my app (I am logged in to that website).

    But If I look through my browser, the account is "OFFLINE"
     
  5. paincake

    paincake Power Member

    Joined:
    Aug 18, 2010
    Messages:
    716
    Likes Received:
    3,099
    Home Page:
    Record requests sent with a browser and compare them to your httpwebrequests. Maybe there's some data being sent via ajax or maybe javascript changes some cookie values
     
    • Thanks Thanks x 1
  6. Kuranyi

    Kuranyi Junior Member

    Joined:
    Dec 21, 2009
    Messages:
    104
    Likes Received:
    51
    Maybe it is javascript (turn it off and then try it out with a browser). But normally you have to do a request every 5 minutes like a normal forum user.
     
    • Thanks Thanks x 1
  7. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    The cookie value is being changed @Browser level (Chrome)
    It adds:
    "authCoss=1; UserName_logined=1"

    But the app does not, so if I add the cookiecontainer with these values it'll bring me a step closer right.

    But I cannot find how to add values to cookiecontainer :/
     
  8. paincake

    paincake Power Member

    Joined:
    Aug 18, 2010
    Messages:
    716
    Likes Received:
    3,099
    Home Page:
    I'm not an expert at httpwebrequest, but maybe this will help:
    Code:
    http://stackoverflow.com/questions/1214387/sending-cookies-using-httpcookiecollection-and-cookiecontainer
     
    • Thanks Thanks x 1
  9. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    hmm, that doesn't work.
    THe problem is:

    The website adds a cookie through javascript probably like you said before.
    (These values which it adds; I could add me manually to the cookiecontainer, but I cannot find how to add custom cookie values)
     
  10. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    bump... stuck like hell
     
  11. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    being marked as online can be tricky depending on how the specific implements their online.

    i've seen a variety of methods from the usual request of a page to having to request a specific image with your session cookies attached to it.

    probably the best way to solve this one is go step by step through the login process reproducing the requests the browser sends until you find the right one.

    it's tedious, but eventually a methodical approach will pay off.

    bottom line there is a request being sent somewhere along the line, tied to your session that is marking the account as online. it's just a matter of finding it.
     
    • Thanks Thanks x 1
  12. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    I've found a way ;

    after login I stay online for 5 minutes.
    So I just loop each account when 5 minutes are over with 1 webbrowser.
    but still, it's very non-accurate.

    What way do you monitor the traffic & cookies etc....?

    thanks
     
  13. shubhamm

    shubhamm Junior Member

    Joined:
    Jan 25, 2010
    Messages:
    107
    Likes Received:
    25
    Occupation:
    Developer
    Location:
    BHW
    i use Fiddler For monitoring & Debugging information to output each value if its working or not

    & use Webrequest store cookies in array as you are saying working with 5-100 acc. similar time loop it then
     
  14. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    What do u mean by storing cookies in an array?

    I still cannot figure the cookies out, eventhough my cookies are 100% correct with the browser cookies... :/
    I'm still missing something
    but dnno what
     
  15. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    After checking out the incoming/response cookies:

    from webbrowser:
    Set-Cookie: xxxxxxxxxxxxxxx; expires=Thu, 01-Jan-1970 00:00:01

    from my code:
    Set-Cookie: xxxxxxxxxxxxxxx; expires=Sun, 02-Jan-2011 00:59:00


    Could the problem be that the cookie expires as soon as I login? (= staying offline?)
    If thats the case; what triggers that cookie to be set & can I hard-mod that cookie?
     
  16. shubhamm

    shubhamm Junior Member

    Joined:
    Jan 25, 2010
    Messages:
    107
    Likes Received:
    25
    Occupation:
    Developer
    Location:
    BHW
    you have to give the Code of WebRequest so i can figure it out what's you doing wrong

    without code we can just give you advice do this or this...
     
    • Thanks Thanks x 1
  17. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    I Pm'd ;)
     
  18. healzer

    healzer Jr. Executive VIP Jr. VIP Premium Member

    Joined:
    Jun 26, 2011
    Messages:
    2,366
    Likes Received:
    1,967
    Gender:
    Male
    Occupation:
    Marketing automation tools
    Location:
    Somewhere in Europe
    Home Page:
    I think it's solved.

    The webbrowser adds an Ajax cookie.
    I redirected manually a httpwebrequest to that Ajax link , which auto-generates a cookie (5 minutes stay-online)

    So I think this problem is SOLVED
     
  19. izSpK

    izSpK BANNED BANNED

    Joined:
    Sep 5, 2010
    Messages:
    1,546
    Likes Received:
    1,666
    Seems like you solved it yourself. If you still have issues, feel free to post it :)