After multiple window.open calls my ASP.NET session

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

  • Run popup
  • Close popup
  • Run a popup in the same application as before, with several different options.
  • Close popup
  • Next query = session timeout in parent window.

Using cookieless sessions fixes the problem, so somehow my cookie is embroidered by the browser. How to use it unchanged, how can this be solved? For what it's worth, I'm developing / testing with IE8.

EDIT

It seems that the problem only occurs when the popup is in the same domain. If I pop up the page elsewhere, there is no problem.

+3
source share
3 answers

Is it possible that another application (in the same domain) sets its own cookie by overwriting the main application file? Can you use a violinist (or similar tool) to find out which cookies are set using the apps?

+1
source

Check all instances of your

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

, , . , NEW cookie ( cookie, , , cookie ) - : http://geekswithblogs.net/ranganh/archive/2009/04/17/asp.net-session-state-shared-between-ie-tabs-and-ie8.aspx

, Set-Cookie. , , , cookie ASP.NET_SESSIONID. ( ) - .

0

edit , cookie, ... , AJAX , ( ), .

JavaScript

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

In the Generic Handler, be sure to add the IRequiresSessionState token interface.

Your session cookie names may be the same.

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

<sessionState
mode="StateServer"
timeout="20"
cookieName="DifferentASP.NET_SessionId"
-1
source

Source: https://habr.com/ru/post/1718316/


All Articles