我的应用程序是 asp classic 和 asp.net 页面的混合体。在 web.config sessionState 模式是 StateServer,因为我在 IIS 中允许多个线程。因此,当我尝试从不同的浏览器\机器访问应用程序时,应用程序状态变量中的值对于每个浏览器都是不同的。我是否缺少 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();