1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

It's Not Possible? One Browser.. Two SessionIDs!?!

Discussion in 'C#' started by Martin Hansen, Jul 12, 2008.

  1. #1
    Hi,

    One of my websites has a strange problem. It kept logging me in AND out unexpectedly.

    Turns out that when I browse the website, or refresh a page, it switches between 2 sessionIDs - seemingly randomly.

    I printed them on the page along with other session vars. These appear and disappear as I see myself 'switched' between the two sessions.

    One minute I'm logged in with access, the next I'm not, then I am, and so on.

    I can log in for both sessionIDs and then it keeps me logged in on for both. When I'm logged in for one session and not the other, it switches between the two, taking all the session variables with it. When I'm not logged in at all, it still switches between 2 sessionIDs.

    This happens in FF and IE on both PCs in my house. I've tried clearing my cookies.

    I don't understand what on earth could be causing it. Any ideas? :eek:

    Thanks in advance for anything you have to say. :)
     
    Martin Hansen, Jul 12, 2008 IP
  2. Sleeping Troll

    Sleeping Troll Peon

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sure it's possible. Somehow you are creating 2 session ID's for the same IP, The server doesn't know the difference, it is just doing as it is told. I suspect at some point you are creating a new session without closing the old one. Where are you creating the sessions? Can we see some code?
     
    Sleeping Troll, Jul 13, 2008 IP
  3. Martin Hansen

    Martin Hansen Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks ST.

    I was having a poke round my code to see where this could be happening... but then :eek: I found it was also happening on other websites of mine. :eek:

    I found that all affected websites were on the same IP address. Sites on other IP addresses (but same hosting company) were not being affected.

    I think the host may be 'load balancing' - I don't fully understand but believe it involves sharing resources across a number of servers. In essence, one website is being served from 2 machines - each with it's own sessionID.

    For anyone else experiencing the same problem, this article on MSDN expands in more detail:

    http://msdn.microsoft.com/en-us/library/ms972338.aspx
     
    Martin Hansen, Jul 14, 2008 IP
  4. Sleeping Troll

    Sleeping Troll Peon

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Is this Megahost by any chance?
     
    Sleeping Troll, Jul 15, 2008 IP
  5. Martin Hansen

    Martin Hansen Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    No it's a small company in Belfast - and thankfully now they sorted it. Seemed reluctant to give any info about what happened thoug.

    Never used megahost - they're a bit evil?
     
    Martin Hansen, Jul 15, 2008 IP
  6. Sleeping Troll

    Sleeping Troll Peon

    Messages:
    217
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    PHP, nothing but PHP, Lots of bells and whistles. I guess they are allright, I am with godaddy right now.

    I understand how load balancing done badly could do that, probably though there is not enough load balancing to handle the traffic on thier servers, so your site is getting swapped so much that it can't keep up!
     
    Sleeping Troll, Jul 15, 2008 IP