0

My application is a mixture of asp classic and asp.net pages. In web.config sessionState mode is StateServer, because I allowed multiple threads in IIS. So when I try to access the application from different browsers\machines the value in Application state variable is different for every browser. Am I missing any setting in web.config?

      Application.Lock(); 
      var sessionId = Session.SessionID; 
      var sessionIDACC = new String(Application("SessionIDACC"));
      if (sessionIDACC == undefined || sessionIDACC == 'undefined')
      {             
         Application("SessionIDACC") = sessionId; 
         sessionIDACC = new String(Application("SessionIDACC"));   
         Response.Write("Added by : " + sessionId);
      } 
     else 
     { 
         if (sessionId != sessionIDACC) 
             Response.Write("Application is locked by : " + sessionIDACC);
         else 
             Response.Write("You are using it! your id is : " + sessionIDACC); 
        }
     Application.Unlock(); 
user692942
  • 16,398
  • 7
  • 76
  • 175
  • Application.Lock(); var sessionId = Session.SessionID; var sessionIDACC = new String(Application("SessionIDACC")); if (sessionIDACC == undefined || sessionIDACC == 'undefined') { Application("SessionIDACC") = sessionId; sessionIDACC = new String(Application("SessionIDACC")); Response.Write("Added by : " + sessionId); } else { if (sessionId != sessionIDACC) Response.Write("Application is locked by : " + sessionIDACC); else Response.Write("You are using it! your id is : " + sessionIDACC); }Application.Unlock(); – user1630477 Aug 13 '15 at 19:18
  • If you are using multiple worker processes for the web application you will not be able to use the built in `Session` object, instead you will have to persist state using some other custom method like storing session state in a database. – user692942 Aug 14 '15 at 00:21

0 Answers0