3

I have an ASP.NET application that uses StateServer session mode with cookieless set to false. In a few places, there is a link that pops up a window to another application (which happens to reside on the same domain, but in a different virtual directory). The following steps give me grief...

  1. Launch popup
  2. Close popup
  3. Launch popup to same app as before with a couple different parameters
  4. Close popup
  5. Next request = session timeout on the "parent" window.

Using cookieless sessions fixes the problem, so somehow my cookie is getting whiped out by the browser. Aside from using cookieless sessions, how can this be resolved? For what it's worth, I am developing/testing with IE8.

EDIT

It seems the problem only occurs when the popup resides on the same domain. If I popup a page elsewhere, there is no problem.

Josh Stodola
  • 81,538
  • 47
  • 180
  • 227
  • What is your session timeout set to? Does this happen instantly no matter what it's set to? – Bryan Sep 23 '09 at 00:12
  • It is set to 60 minutes, and yes it happens regardless of how high/low I set it. – Josh Stodola Sep 23 '09 at 13:06
  • We get the same issue with IE8 and can't find a work around either. Is your test case reproducible because we can't reproduce on demand? – Schotime Sep 22 '10 at 02:12
  • 1
    I am also having this issue. I am hoping someone out there may know of a solution or workaround. –  Aug 04 '11 at 15:46
  • Please email me a URL to your site, or, failing that, send a traffic capture (www.fiddlercap.com) that demonstrates this happening. – EricLaw Aug 17 '11 at 00:29
  • @EricLaw Wow buddy, a couple years late. I don't even work there any more (thank God) – Josh Stodola Aug 17 '11 at 02:30
  • Heheh! Attaching a bounty to someone else's 2-year-old question can definitely cause a few double-takes! :) – mikemanne Aug 17 '11 at 21:23
  • 1
    Heh. Well, that goes for whoever else is having this problem. FWIW, we've made at least one fix for this problem over the last two years, so the original issue may be long fixed. – EricLaw Aug 18 '11 at 00:33

3 Answers3

1

Is it possible the other app (on the same domain) is setting its own cookie, overwriting that of your primary app? Can you use fiddler (or similar tool) to see which cookies are being set by which apps?

mikemanne
  • 3,535
  • 1
  • 22
  • 30
0

Check all instances of your

Session.Clear();
Session.Abandon();

If you aren't using those at all, then its likely the case that your browser windows are set to NOT share sessions between. So the new instance gets a NEW session cookie (since its the same cookie name as the prior one, it could possibly kill the existing session cookie)- as in a play on: http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx

Ideally track down in which page the Set-Cookie header is coming across. Look then at the request going INTO that response and see if your current ASP.NET_SESSIONID cookie is sent over. (fiddler is indeed the best tool for this) Anyway - its a start to try.

Adam Tuliper
  • 29,982
  • 4
  • 53
  • 71
  • Btw - you can just set a different cookie domain for your cookies in various apps to prevent the stomping after you figure out which app is doing it. See http://forums.asp.net/t/1332808.aspx/1 remember unless you specify it, domain.com will send cookies to sub.domain.com – Adam Tuliper Aug 23 '11 at 19:24
-1

edit Apparently it's not your cookie name, so... Perhaps you should have an AJAX call on your master page that pings a service (or generic handler) on your web app to keep the session alive.

JavaScript

window.setInterval(function() { 
    $.get('ping.ashx?nocache=' + (new Date()).getTime(), function() { 
        return true; 
    })
}, 30000);

In the Generic Handler, make sure to add the IRequiresSessionState marker interface.

Perhaps your session cookie names are the same.

In your web.config (for one of the applications) change the session cookie name.

<sessionState
mode="StateServer"
timeout="20"
cookieName="DifferentASP.NET_SessionId"
Louis Ricci
  • 20,804
  • 5
  • 48
  • 62